Authentication has failed: invalid_clientUnauthorized error[ Edited ]
March - last edited March by Shalini S
Hi API Team,
I’m running into an issue when attempting to connect via Web connection on oauth2 with the approved username. The API has already been enabled in developer console and client secrets are accurate.
Following the oauth2 authentication process, I'm able to complete the authentication flow via web successfully, but receive a failure message shortly after saying "Authentication has failed, invalid_clientUnauthorized"
I've made attempts using different API versions to no avail.
Any advice would help!
Re: Authentication has failed: invalid_clientUnauthorized error
It looks like the error you experienced may be related to OAuth 2.0 Authorization using the OAuth 2.0 client ID. Can you verify that the access token is being retrieved correctly? Note that, when using the OAuth 2.0 client ID for authorization, you should store the refresh token for future use and use the access token to access the API. Once the access token expires, the application should use the refresh token to obtain a new one. This way, your application will always be able to request a new access token when necessary. This process requires a user to manually authorize the application only once.
Please follow the Make a simple HTTP request step thoroughly on the Get Started page of the documentation website to learn how to use the OAuth 2.0 Playground to experiment with the Google My Business API.
Note that you should write your code to anticipate the possibility that a granted token might no longer work for various reasons, and obtain a new token when the existing token is deemed invalid.
The Google My Business API team