I am programming a web server to support oAuth2 for Google APIs and am following this documentation. Everything seems to be working fine up to the point where I try to make a Google API using the Access Token. Example call from the documentation:
https://www.googleapis.com/oauth2/v1/userinfo?access_token=1/fFBGRNJru1FQd44AzqT3Zg
When I try it with my access token I get 401 invalid token error.
Looking through the literature, all examples show the Access Token in format 1/fFBGR....... My Access Token is of form ya29.AHES67z....... and is much longer (see the snippet below containing response from google).
oauth2 request:{
"access_token" : "ya29.AHES67zeEn-RDg9CA5gGKMLKuG4uVB7W4O4WjNr-NBfY6Dtad4vbIZ",
"token_type" : "Bearer",
"expires_in" : 3600
}
So it appears my token is incorrect. Do I have to encode/decode it?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…