API: Google Login?
Is there a way to do a Google login via API?
Asked by Yaron on Oct 19, 2012 - 09:26
It means that oauth2_token is either incorrect or outdated, or issued for the wrong scope.
You can check if the token is correct by performing the HTTP request to Google API by yourself. The query can be performed with just a web-browser, and you should open the URL https://www.googleapis.com/oauth2/v1/userinfo?access_token= . If you get the JSON response with "Login required", it means that access token is invalid.
"Classic" OAuth 2.0 protocol flow is a two-step process. It suggests that client receives authorization code first, and then exchanges this authorization code to the access token. It's wrong to pass authorization code to requests where the access token is expected. Please refer to this chapter of RFC for more information: http://tools.ietf.org/html/rfc6749#section-4.1