2. Exchange authorization code for refresh and access tokens

To exchange an authorization code for an access token, call the https://oauth2.googleapis.com/token endpoint and set the following parameters:

Fields
Value
Required

client_id

329011709740-sq6l548671df39l5bingat6kpd0rmuth.apps.googleusercontent.com

Yes

client_secret

xxx

Yes

code

4/0AWgavdeTEPxfXAPtbSUqv2OrbfRPywz7JUhCeZbDV4smVxBOgztU4TzFqNOwC0diUCCPog

Yes

grant_type

authorization_code

Yes

redirect_uri

http://localhost:5001/callback

Yes

POST https://oauth2.googleapis.com/token/

Query Parameters

Name
Type
Description

client_id*

String

329011709740-sq6l548671df39l5bingat6kpd0rmuth.apps.googleusercontent.com

client_secret*

String

xxx

code*

String

4/0AWgavdeTEPxfXAPtbSUqv2OrbfRPywz7JUhCeZbDV4smVxBOgztU4TzFqNOwC0diUCCPog

grant_type*

String

authorization_code

redirect_uri*

String

http://localhost:5001/callback

{
  "access_token": "1/fFAGRNJru1FTz70BzhT3Zg",
  "expires_in": 3920,
  "token_type": "Bearer",
  "scope": "https://www.googleapis.com/auth/drive.metadata.readonly",
  "refresh_token": "1//xEoDL4iW3cxlI7yDbSRFYNG01kVKM2C-259HOF2aQbI"
}

Last updated