Ninad
Ninad

Reputation: 484

How to get access token using refresh token?

In my app we want to provide login with google. So i went throught the folowing Quickstart and created a sample extending it by setting access_type to offline. So that i can get refresh token as their will be background task that will perform operation on those account after a particular interval of time, example: saving starrred mail in some file on server for each user.

So i need to know:

  1. How to save refresh token ? like save it in DB with userId or somthing or save whole credential object as few post i have seen use credential object
  2. How to use refresh token to get accesstoken ?
  3. When does refresh token expires?

Code reference will be very useful.

Thank you!!

Upvotes: 3

Views: 1034

Answers (1)

Srinivasu
Srinivasu

Reputation: 1235

1.You can save the refresh token in DB as like userId, you can get new access token by using the refresh token

2.You need to pass the Client Id, Client Secret and Refresh token to get the new access token

3.Refresh tokens are valid until the user revokes access.

Upvotes: 1

Related Questions