Google plus for android bad access token

2019-08-03 02:43发布

问题:

I been following Getting started and sign in to get access_token of user.

I do get an access token but when using it i am getting this error:

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "authError",
    "message": "Invalid Credentials",
    "locationType": "header",
    "location": "Authorization"
   }
  ],
  "code": 401,
  "message": "Invalid Credentials"
 }
}

When I am going to apis-explorer and using they token it works just fine. Any ideas what am I missing?

This is then URL I am trying.

https://www.googleapis.com/plus/v1/people/me?key={my_api_key}&access_token=my_access_token

回答1:

These tokens have a 1 hour expiration period.



回答2:

Ping the server with some query every time you start the app and before starting your functions,this would refresh the token.