Skip to main content
All CollectionsFeaturesAPI
Set up refreshing tokens

Set up refreshing tokens

Authorize API requests with Oauth2

Luciano Marzoni avatar
Written by Luciano Marzoni
Updated over 2 weeks ago

The access tokens for some APIs expire after a certain time, that’s where refreshing tokens come into play as they allow systems to request new tokens.

For Sheetgo HTTPS requests that means you don’t have to reconfigure the automation every time the token expires.

Configuring an automation with refreshing tokens

  1. Create a new automation.

  2. Under Choose a source, select HTTPS.

  3. Choose the Basic editor to fill out a form, or the Advanced editor to provide a plain text header.

  4. Include the information detailed in the next section.

Required information for refreshing tokens

These fields must be included in the header so Sheetgo can automatically request a new token.

These fields vary by API, always refer to the provider's documentation for exact requirements.

Parameters:

  • auth_method: Set to "oauth2" to enable token refreshing.

  • auth_type: Type of authorization used (e.g. "Bearer", "Basic", "OAuth").

  • refresh_url: The URL endpoint used to request a new access token.

  • refresh_headers (optional): Headers required by the API when refreshing the token.

  • refresh_params: Key-value pairs required by the API to issue a new token.

“auth”: {
"auth_method": "oauth2",
"auth_type": "OAuth",
"refresh_url": "https://www.googleapis.com/oauth2/v4/token",
“refresh_headers”: {
"Authorization": "Basic Z4bDZyNmxHUU5rWlNzdEVNU1FzYThwUQ=="
},
"refresh_params": {
"client_id": "<CLIENT ID>",
"client_secret": "<CLIENT SECRET>",
"refresh_token": "<REFRESH TOKEN>",
"grant_type": "refresh_token"
}
}

Did this answer your question?