> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stackone.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect Anaplan with OAuth 2.0 (Device Grant) – StackOne Hub

> Link a Anaplan account in the StackOne Hub using OAuth 2.0 (Device Grant). End-user guide to authorize the integration and start using Anaplan actions.

> [!WARNING]
>
> Only a tenant security administrator can create OAuth 2.0 clients. A Device grant client is a SEPARATE registration from an Authorization code grant client - the same Client ID cannot serve both. Device grant is disabled when single sign-on (SSO) is enabled.

## Create a Device grant OAuth client

Sign in to Anaplan as a tenant security administrator.

<ul>
  <li>Select **Administration** from the top-left navigation menu.</li>
  <li>Select **Security** > **OAuth Clients**, and select **Enable OAuth** if this is the first time.</li>
  <li>Select **New**, enter a **Name**, and select **Device grant** from the **Type** dropdown.</li>
  <li>**Allowed callback URLs** is required by the form but unused for a device client - enter any valid URL, for example `https://anaplan.com`.</li>
  <li>Set the refresh token behaviour. **Non-Rotatable** tokens never expire, so the connection never needs re-authorising - this is the recommended setting for StackOne. **Rotatable** tokens expire after the maximum lifetime you set (43,000 seconds by default), after which the account must be re-linked by hand.</li>
  <li>Select **Create client** and copy the **Client ID**.</li>
</ul>

## Complete the device authorisation once

Run these two calls yourself to turn the Client ID into a refresh token. Replace the host with the OAuth service URL for your region (see the field description below).

**1. Request a device code**

```
POST https://us1a.app.anaplan.com/oauth/device/code
Content-Type: application/json

{"client_id": "<your client id>", "scope": "openid profile email offline_access"}
```

<ul>
  <li>The response carries a `device_code` and a verification URL.</li>
  <li>Open the verification URL in a browser (incognito is recommended) and sign in to approve the device.</li>
</ul>

**2. Exchange the device code for a refresh token**

```
POST https://us1a.app.anaplan.com/oauth/token
Content-Type: application/json

{"grant_type": "urn:ietf:params:oauth:grant-type:device_code",
 "device_code": "<device code from step 1>",
 "client_id": "<your client id>"}
```

<ul>
  <li>Copy the `refresh_token` from the response into the **Refresh Token** field below.</li>
  <li>The `access_token` in the same response is not needed - the connector requests its own and renews it every 35 minutes.</li>
</ul>

## Link the Account

**1. Connect**

<ul>
  <li>Click **Connect**.</li>
  <li>If applicable, the provider will redirect you to a sign-in or authorization page. Complete the provider's authorization flow.</li>
  <li>Once authorization is successful, you will see a confirmation popup.</li>
</ul>

**2. Use Actions**

Connect an AI platform to the linked account's actions. See [AI Platforms](https://docs.stackone.com/connect/ai-platforms/overview.md).

Other ways to call actions are listed in [Protocols & SDKs](https://docs.stackone.com/connect/protocols-and-sdks.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.