Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does my Google oAuth2 Token look right?

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?

like image 953
M Schenkel Avatar asked Apr 24 '12 04:04

M Schenkel


1 Answers

I've been recently playing around with OAuth2.0 from VBA.

Authorization Code Begins With: 4/Omoy    (30 Characters Long)  
Access_Token Begins With:       ya29.AHES (60 Characters Long)    
Refresh_Token Begins With:      1/Ry68    (45 Characters Long)  

I didn't have to do any decoding or encoding to use these values. These were working, functional values.

like image 139
HK1 Avatar answered Sep 19 '22 15:09

HK1