Gmail API OAuth error: parameter not allowed for this message type: redirect_uri

The Gmail OAuth API runs until February 17, and POST /o/oauth2/tokenrandomly returns this error when updating the OAuth token:

Parameter not allowed for this message type: redirect_uri

The error occurs approximately 1 out of 10 times. It is strange that after receiving this error, the next exact request was successful. So this is not related to "redirect_uri" as suggested by the error message.

"A parameter not permitted for this message type" was specified in other StackOverflow messages, but all of them are persistent errors and can be fixed by correcting the parameters. Although we got a temporary error. A 10% rate is expensive for users.

Has anyone seen this behavior lately?

+4
source share
2 answers

It seems Google recently changed the URL to get a new access token from the update token. The older URL was https://accounts.google.com/o/oauth2/token , and the new one was https://www.googleapis.com/oauth2/v4/token .

I also remember that I was redirect_uripreviously among the options for obtaining a new access token, but it no longer exists: https://developers.google.com/identity/protocols/OAuth2WebServer#offline . Just check out the HTTP / REST example.

It is possible that only removal redirect_uriworks even with an older url, but I think it is wise to change the url and delete redirect_uri.

+4

Source: https://habr.com/ru/post/1693938/


All Articles