How to get update token using Google OAuth2 Javascript library?

I use the OAuth2 JavaScript library to request an access token from users. I want to save the token in the database on the server.

In order to be able to access user data after the expiration date, I also need to save the update token. I know how to do this when using the Google OAuth2 server library (specify access_type = offline), but I need to be able to do this with the client Javascript library, and it does not work.

+4
source share
1 answer

You do not want to save the update token in the client! It would be like saving his username and password.

The Javascript client does not support type = offline, as this may open the update token.

Your choice: -

  • Generate and save the update token on the server
  • Ask your client to simply continue to request access tokens as needed. Set immediate=true so that there is no visible user interaction.
+8
source

All Articles