Google Drive API request to generate refresh token

Refresh tokens can be used to generate access tokens for API requests. Use the following steps:

Step1: Generate access code

You can create an access code through the Google OAuth 2.0 Playgrounds website. If you are doing this through browser URL with redirect link as ‘localhost’, you will get:

 http://localhost/?state=state_parameter_passthrough_value&code={actual_code_here}&scope=https://www.googleapis.com/auth/drive.file

Step2: Send API request via Postman to create a refresh token for the Google Drive:

Request type: POST

URI: ‘https://accounts.google.com/o/oauth2/token’

In the body section, choose ‘x-www-form-urlencoded’

“Request Body”: 

{

code: {Your code here},

    client_id: {Your client ID here},

    client_secret: {Your client secret value here},

    redirect_uri: http://localhost,

    grant_type: authorization_code,

 }

Leave a comment

Your email address will not be published. Required fields are marked *