1

I'm getting an access token from the Android SDK which I'm sending to the server. On the server side, I'm calling the following API to validate my token:

https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=<token here>

From Google, I'm getting the following response (partial response added):

{\"statusCode\":200,\"body\":\"{n \"issued_to\": 
\"407408718192.apps.googleusercontent.com\",n \"audience\":
\"407408718192.apps.googleusercontent.com\",n \"user_id\": 
\"110586055381870434283\",n \"scope\": 
\"https://www.googleapis.com/auth/plus.login 
https://www.googleapis.com/auth/plus.me"}

Unfortunately, this JSON is not parseable because of the backslashes & i'm not able to validate the token identity.

Is this a problem with the Google API or do I need to apply any regex?

Rohit Lala
  • 257
  • 1
  • 3
  • 11

1 Answers1

0

Google sends back proper JSON without the slashes, being exactly the part that's inside the "body" element of the output that you paste (well without the slashes).

So your Node.js HTTP client is wrapping it with the HTTP status code element and puts in the slashes as well, so your clients need convert back from that on its own.

Hans Z.
  • 50,496
  • 12
  • 102
  • 115