Expired access token in Google OAuth

I sought in Internet how to determine from Google response whether an access token is expired. I found no definitive answer.

So, finally I created an access token and waited for a hour to see the Google response when I try to use this token.

The Google response (with a partial list of HTTP headers) is below:

HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer realm="https://accounts.google.com/", error=invalid_token
Content-Type: application/json; charset=UTF-8

Username/Password Authentication Failed.

A weird thing is that Google says that it is application/json but the response body is not a JSON.

So the only way is to check whether the response HTTP status is 401.

Advertisements
This entry was posted in Uncategorized and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s