Skip to navigation

Set up the OAuth 2.0 client credentials grant for an HTTP connector

View as Markdown

OAuth 2.0. The client credentials grant sends a valid Client ID and Client Secret to the provider’s token URL in exchange for an Access Token. The Access Token is then used in subsequent requests to authenticate the API Request. Use it when you have a client ID and secret for an app or service identity. For other grants, see Choose a grant.

Before you begin

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

Enter the client credentials

  1. Select Oauth2 from the Auth Config dropdown.

  2. Set Oauth2 Grant Type to Client Credentials Grant, then fill in its fields:

    FieldWhat to enter
    Client IDYour Client ID.
    Client SecretYour Client Secret.
    Client Credentials Grant ScopeOptional. The scopes associated with the OAuth credentials, separated by a single space. A value here wins over a scope in Additional Request Data.

    The Oauth2 form with Client Credentials Grant selected, showing the Client ID, Client Secret and Client Credentials 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.

The first token request looks like this. If it fails for any reason, Moveworks retries with the client ID and secret as a Basic Authorization header instead; see How the token request is sent.

curl --location '<OAUTH2_TOKEN_URL>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'client_id=<YOUR_CLIENT_ID>' \
--data-urlencode 'client_secret=<YOUR_CLIENT_SECRET>' \
--data-urlencode '<EXTRA_KEY>=<EXTRA_VALUE>'

Save and confirm it works

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