I have completed steps of authorization and obtained access token and refresh token.
What should I do next to generate access token using refresh token that I have stored through google drive API?
I won't be able to use any sdk since I am working on Force.com so please suggest the way to implement it directly through the API.
Because OAuth2 access expires after a limited time, an OAuth2 refresh token is used to automatically renew OAuth2 access. Click the tab for the programming language you're using, and follow the instructions to generate an OAuth2 refresh token and set up the configuration file for your client.
A refresh token can help you balance security with usability. Since refresh tokens are typically longer-lived, you can use them to request new access tokens after the shorter-lived access tokens expire.
If you are using web api then you should make a http POST
call to URL : https://www.googleapis.com/oauth2/v4/token
with following request body
client_id: <YOUR_CLIENT_ID> client_secret: <YOUR_CLIENT_SECRET> refresh_token: <REFRESH_TOKEN_FOR_THE_USER> grant_type: refresh_token
refresh token never expires so you can use it any number of times. The response will be a JSON like this:
{ "access_token": "your refreshed access token", "expires_in": 3599, "scope": "Set of scope which you have given", "token_type": "Bearer" }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With