Skip to navigation

Set up the OAuth 2.0 refresh token grant for an HTTP connector

View as Markdown

OAuth 2.0. The refresh token grant exchanges a Refresh Token you already have, along with your Client ID and Client Secret, for an Access Token. When the Access Token expires, the Refresh Token is used to retrieve a new one from the token URL. Use it when you have a long-lived refresh token and the provider has no client credentials flow for you. For other grants, see Choose a grant.

Providers that rotate refresh tokens

If your provider rotates refresh tokens and invalidates the old one on use, this grant stops working after the first refresh, because the new refresh token isn’t saved.

Before you begin

  • Start creating an HTTP connector and fill in its details up to Auth Config.
  • Get the client ID, client secret, refresh token and full token URL from the provider.

Enter the refresh token

  1. Select Oauth2 from the Auth Config dropdown.

  2. Set Oauth2 Grant Type to Refresh Token Grant, then fill in its fields:

    FieldWhat to enter
    Client IDYour Client ID.
    Client SecretYour Client Secret.
    Refresh Token Grant Refresh TokenYour Refresh Token.
    Refresh Token Grant ScopeLeave this blank. It isn’t sent. If the provider needs a scope, add it under Oauth2 Custom Oauth Request Options Additional Request Data.

    The Oauth2 form with Refresh Token Grant selected, showing the Client ID, Client Secret, Refresh Token Grant Refresh Token and Refresh Token Grant Scope fields.

Fill in the token request fields

FieldWhat to enter
Oauth2 Token UrlThe full token URL.
Oauth2 Custom Oauth Response Response TypeMoveworks reads the token from access_token and the expiry from expires_in in a JSON response. Text isn’t applied, so providers that return the token as plain text aren’t supported. To read the token or expiry from different keys, select Json and set Access Token Key (optional) or Expires In Key (optional).
Header Auth Key (Optional)Leave blank to send the access token in the Authorization header.
Header Auth Value Pattern (Optional)Leave blank to send the access token as Bearer <token>, even though the form says it defaults to %s. If you enter a pattern, include %s where the token goes.
Custom Grant Type (Optional)Leave blank. The default for the selected grant is used.
Oauth2 Custom Oauth Request Options Additional HeadersOptional. Extra headers for the token request, if the provider needs them. The connector’s Common headers (Optional) and Common query params (Optional) aren’t sent on the token request, so put anything the token endpoint needs here. To send the body as JSON, add an entry named Content-Type (exactly, case-sensitive) with the value application/json (exactly, with no ; charset).
Oauth2 Custom Oauth Request Options Additional Request DataOptional. Extra body fields for the token request, such as scope or audience, if the provider needs them. A key here replaces the standard value of the same name, such as grant_type. The exception is Client Credentials Grant Scope: when set, it wins over a scope here.

The token request fields shared by the Oauth2 grants, from Oauth2 Token Url to Oauth2 Custom Oauth Request Options Additional Request Data.

Moveworks sends the client ID and secret in the request body first, then as a Basic Authorization header if that fails; see How the token request is sent.

Save and confirm it works

Save the connector, then test it from an action that uses it.