Google OAuth2 is reporting expired token

Google OAuth2 is reporting expired token

Brian Ball -
回帖数:3
Execute scheduled task: Refresh OAuth tokens for service accounts (core\oauth2\refresh_system_tokens_task)
... started 13:22:10. Current memory use 14.5 MB.
Could not refresh OAuth 2 token. HTTP status for remote endpoint: 400
... used 48 dbqueries
... used 19.321053028107 seconds
Scheduled task failed: Refresh OAuth tokens for service accounts (core\oauth2\refresh_system_tokens_task),Could not refresh OAuth 2 token for one or more issuers. View task output for details.

I received the email from the task running and failing. I checked the task logs, my refresh task runs every 30 minutes. It was good this morning until 9:30, now it fails every time. I've been 
through the forum posts and continue to come up empty. The only thing I have not tried is to connect to a system account. Seems illogical since Moodle says it is good, but the task keeps failing. 
I don't have the password to the account that was used, and I'm afraid that if I change the account password, it may break something else. Has anyone been able to solve this another way? 
Why is that endpoint reporting error 400?
I can't seem to access the token endpoint: 

https://oauth2.googleapis.com/token

回复Brian Ball

Re: Google OAuth2 is reporting expired token

Ken Task -
Particularly helpful Moodlers的头像
That's a tough one ... but ...
so the google system account being used shows a green check mark?

You don't have the password to that account ... not good ... cause it's under that system account that has the IAM configuration for your moodle.
secret/key/call back/TOS link/as well as Privacy link etc.  400 is a not authorized thang.

Is your entity a Google Edu?   You probably need to contact your Google Edu domain admin to see what's up with that system account.

'SoS', Ken

回复Brian Ball

Re: Google OAuth2 is reporting expired token

Brett Dalton -
Moodle HQ的头像 Particularly helpful Moodlers的头像
Its a 400 error which is a bad request, rather than a 401 which is not authorised. So this looks to be something is malformed rather than a bad token or invalid refresh token. Possible for some reason the same nonce is being sent multiple times, but it could also be a lot of other things. If it was OAuth rather than OAuth2 I'd say check the system clock is set correctly, but thats unlikely to be the case in this day and age. its a hard one to be sure.
回复Brett Dalton

Re: Google OAuth2 is reporting expired token

Brian Ball -
Bad Request - Response_Type seems to be the issue.
Google wants response_type=code
I added the line in the OAuth2 Google config in Moodle, same issue.
I would like to see the actual code that the task compiles and sends via the URL Request. Anyone know where to find this?