---
schema_version: "1"
id: 03ab1b92b52f874415bf29c876838ea64b09d6f4a727d85900485c6872c21f19
title: OAuth Tokens and Scopes
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/remoteaccess_oauth_tokens_scopes.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.remoteaccess_oauth_tokens_scopes.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: d4b05a5fd691644588cc5db758288b7486e74f881b1152ffdd88eb50fd947612
description: OAuth tokens authorize access to protected resources. Connected apps receive tokens on behalf of a client after authorization. Scopes further define the type of protected resources that the connected app can access. You assign scopes to a connected app when you build it, and they’re included with the OAuth tokens during the authorization flow.
products:
  - Security
  - Cross Cloud
release: "264"
---
# OAuth Tokens and Scopes

OAuth tokens authorize access to protected resources. Connected apps receive tokens on behalf of a client after authorization. Scopes further define the type of protected resources that the connected app can access. You assign scopes to a connected app when you build it, and they’re included with the OAuth tokens during the authorization flow.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: both Salesforce Classic and Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>All</strong> Editions</td></tr></tbody></table>

## OAuth Tokens

Depending on the authorization flow, the authorizing server can provide these OAuth tokens to the client.

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
        <colgroup>
          <col style="width:19.493177387914233%">
          <col style="width:80.50682261208577%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d56461e69">OAuth Token</th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d56461e72">Description</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="OAuth Token" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e69 ">Authorization code</td>

            <td data-label="Description" class="slds-cell-wrap" id="remoteaccess_oauth_tokens_scopes__auth_code_desc" style="vertical-align:top;" headers="d56461e72 ">The authorization server creates an authorization code,
              which is a short-lived token, and passes it to the client after successful
              authentication. The client sends the authorization code to the authorization server
              to obtain an access token and, optionally, a refresh token.</td>

          </tr>
          <tr class="">
            <td data-label="OAuth Token" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e69 ">Access token</td>

            <td data-label="Description" class="slds-cell-wrap" id="remoteaccess_oauth_tokens_scopes__access_token_full_desc" style="vertical-align:top;" headers="d56461e72 ">
              <p>After a client is authorized, Salesforce sends the
                client an access token. The client passes the access token to the resource server to
                request access to protected resources. The resource server validates the access
                token and additional permissions in the form of scopes before granting access to the
                client.</p>
              <p>The access token has a longer lifetime than the authorization code,
                usually minutes or hours. When an access token expires, attempts to use it fail.
                The client must obtain a new access token by using a refresh token or reinitiating
                the authorization flow.</p>
              <p>The client must be able to protect the access token
                against interception by a protocol such as Transport Layer Security (TLS or SSL).
              </p>
              <p>To implement an OAuth 2.0 authorization flow that uses an access token,
                assign the <code>web</code> scope to the connected app that is integrating the
                client with the Salesforce API.</p>
              <p>After receiving an access token, the client
                can use one of these methods to request access.</p>
              <ul>
                <li>For REST API, use an HTTP authorization header with this format:
                  <code>Authorization: Bearer <var>Access_Token</var></code>.
                </li>

                <li>For SOAP API, use the SessionHeader SOAP authorization header. The access
                  token is placed in the header.</li>

                <li>For the identity URL, use either an HTTP authorization header (as with REST
                  API) or an HTTP parameter <code>oauth_token</code>.</li>

              </ul>
              <p>Salesforce grants unique access tokens for each connected app (client) and
                user combination. But it’s possible for Salesforce to issue the same access token
                to different service providers under these conditions: </p>
              <ul>
                <li>You configure a single connected app for multiple service providers.</li>

                <li>A user has an active session with one service provider. The user then logs in
                  to a different service provider by using the same connected app that was
                  configured for both service providers.</li>

              </ul>
              <p style="margin-bottom:0;">To make sure that different service providers receive unique access tokens,
                create a distinct connected app for each service provider.</p>
            </td>

          </tr>
          <tr class="">
            <td data-label="OAuth Token" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e69 ">Refresh token</td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e72 ">
              <p>A client can use a refresh token repeatedly to gain access to the resource
                server. When a refresh token expires or a user revokes it outside of the client, the
                client requests a new access token, typically by implementing the authorization flow
                from the start.</p>
              <p>A refresh token can have an indefinite lifetime, persisting for an
                admin-configured interval or until explicitly revoked. The client can store a
                refresh token and use it to obtain new access tokens. For security, the client
                must protect a refresh token against unauthorized access.</p>
              <p style="margin-bottom:0;">If the request
                includes the <code>refresh_token</code> or <code>offline_access</code>
                scope, the OAuth 2.0 user-agent and the OAuth 2.0 web server flows can request
                refresh tokens.</p>
            </td>

          </tr>
          <tr class="">
            <td data-label="OAuth Token" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e69 ">
              <span id="remoteaccess_oauth_tokens_scopes__ID_token"><a name="remoteaccess_oauth_tokens_scopes__ID_token"><!-- --></a>ID token</span>
            </td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e72 ">
              <p>The ID token is a signed data structure that contains authenticated user
                attributes, including a unique identifier for the user and when the token was
                issued. It also identifies the requesting client app. Salesforce can respond to an
                OAuth request with an ID token that conforms to the <a href="http://openid.net/specs/openid-connect-basic-1_0-28.html" target="_blank">OpenID Connect specifications</a>. </p>
              <p>If the request includes
                these parameters, both the OAuth 2.0 user-agent and OAuth 2.0 web server flows can
                request a signed ID token. The returned token is a JSON web token (JWT).</p>
              <ul>
                <li>The user-agent flow must include the <code>response_type</code> parameter
                  with the <code>token id_token</code> value, the <code>openid</code>
                  scope, and the <code>nonce</code> parameter.</li>

                <li>The web server flow must include the <code>response_type</code> parameter
                  with the <code>code</code> value, and the <code>openid</code> scope. The
                  <code>nonce</code> parameter is optional.
                </li>

              </ul>
              <div>
                <p>Here’s an example request for an ID token by using the user-agent
                  flow.</p>
                <pre class="line-numbers slds-box slds-box_x-small slds-theme_shade slds-m-top_medium slds-m-bottom_medium slds-scrollable_x"><code>https://<var>MyDomainname</var>.my.salesforce.com/services/oauth2/authorize?response_type=token+id_token
&amp;redirect_uri=https://<var>MyDomainName</var>.my.salesforce.com/services/oauth2/success
&amp;client_id=3MVG9lKcPoNINVBIPJjdw1J9LLJbP_pqwoJYyuisjQhr_LLurNDv7AgQvDTZwCoZuD_
3Oxug0sU3_WrBPd_Ax6Mcnlg5HSnLGQ&amp;scope=openid&amp;nonce=somevalue</code></pre>
              </div>
              <p style="margin-bottom:0;">Use
                the published public keys to verify that the signature in the response is a valid
                Salesforce signature. On
                <samp class="filepath">MyDomainName.my.salesforce.com/id/keys</samp>, the response
                includes JSON-formatted information about the public keys used for signing.
                Validate the signature by using the key with the correct <code>kid</code>
                value, which specifies the release version.
              </p>
            </td>

          </tr>
          <tr class="">
            <td data-label="OAuth Token" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e69 ">Initial access token</td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e72 ">Salesforce requires an initial access token to authorize the dynamic client
              registration request flow. After configuring an OAuth 2.0 connected app, generate an
              initial access token.</td>

          </tr>
          <tr class="">
            <td data-label="OAuth Token" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e69 ">Asset token</td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e72 ">For efficient token exchange and automatic linking of devices to Service Cloud
              Asset data, a client can implement the OAuth 2.0 device flow. In this flow, the
              client can exchange an access token and an actor token for an asset token. This flow
              combines asset token issuance and asset registration.</td>

          </tr>
          <tr class="">
            <td data-label="OAuth Token" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e69 ">Delete token</td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e72 ">A token that can be used to revoke refresh tokens and associated access tokens.
              This token is represented by the <samp class="parmname">DeleteToken</samp> field on the <a href="https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_oauthtoken.htm" target="_blank">OauthToken</a> object. To use this token,
              include it in a request to the OAuth 2.0 revocation endpoint, or use Apex. See <a href="https://help.salesforce.com/s/articleView?id=xcloud.remoteaccess_revoke_token.htm&amp;type=5&amp;language=en_US" target="_blank">Revoke Opaque OAuth
                Tokens</a>.</td>

          </tr>
        </tbody>
      </table>

## OAuth Scopes

You can assign these OAuth scopes to the connected app to define the type of protected resources that the client can access.

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
        <colgroup>
          <col style="width:50%">
          <col style="width:50%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d56461e289">Value</th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d56461e292">Description</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e289 "><strong class="uicontrol">Perform ANSI SQL queries on Customer Data Platform data</strong>
              (<code>cdp_query_api</code>)</td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e292 ">Allows ANSI SQL queries of Data Cloud data on behalf of the user.</td>

          </tr>
          <tr class="">
            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e289 "><strong class="uicontrol">Manage Pardot services</strong> (<code>pardot_api</code>)</td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e292 ">Allows access to Marketing Cloud Account Engagement API services on behalf of
              the user. Manage the full extent of accessible services in Account Engagement.
              (Pardot is now Marketing Cloud Account Engagement.) </td>

          </tr>
          <tr class="">
            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e289 "><strong class="uicontrol">Manage Customer Data Platform profile data</strong> (<code>cdp_profile_api</code>)</td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e292 ">Allows access to Data Cloud REST API data. Use this scope to manage profile
              records.</td>

          </tr>
          <tr class="">
            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e289 "><strong class="uicontrol">Access Connect REST API resources</strong> (<code>chatter_api</code>)</td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e292 ">Allows access to some Connect REST API resources on behalf of the user. To
              allow access to all Connect REST API resources, use the <code>api</code>
              scope.</td>

          </tr>
          <tr class="">
            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e289 "><strong class="uicontrol">Manage Customer Data Platform Ingestion API data</strong>
              (<code>cdp_ingest_api</code>)</td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e292 ">Allows access to Data Cloud Ingestion API data. Use this scope to upload and
              maintain external datasets in Data Cloud. This scope is packaged in a JSON web token
              (JWT).</td>

          </tr>
          <tr class="">
            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e289 "><strong class="uicontrol">Access Analytics REST API Charts Geodata resources</strong>
              (<code>eclair_api</code>)</td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e292 ">Allows access to the Analytics REST API Charts Geodata resource.</td>

          </tr>
          <tr class="">
            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e289 "><strong class="uicontrol">Access Analytics REST API resources</strong> (<code>wave_api</code>)</td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e292 ">Allows access to the Analytics REST API resources.</td>

          </tr>
          <tr class="">
            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e289 "><strong class="uicontrol">Manage user data via APIs</strong> (<code>api</code>)</td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e292 ">Allows access to the current, logged-in user’s account by using APIs, such as
              REST API and Bulk API 2.0. This scope also allows access to all Connect REST API
              resources.</td>

          </tr>
          <tr class="">
            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e289 "><strong class="uicontrol">Access custom permissions</strong> (<code>custom_permissions</code>)</td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e292 ">Allows access to the custom permissions in an org associated with the connected
              app. This scope also shows whether the current user has each permission
              enabled.</td>

          </tr>
          <tr class="">
            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e289 "><strong class="uicontrol">Access the identity URL service</strong> (<code>id, profile, email, address, phone</code>)</td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e292 ">Allows access to the identity URL service. You can request
              <code>profile</code>, <code>email</code>, <code>address</code>, or
              <code>phone</code> individually to get the same result as by using
              <code>id</code> because they’re synonymous.
            </td>

          </tr>
          <tr class="">
            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e289 "><strong class="uicontrol">Access Lightning applications</strong> (<code>lightning</code>)</td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e292 ">Allows hybrid apps to directly obtain Lightning child sessions through the
              OAuth 2.0 hybrid app token flow and hybrid app refresh token flow.</td>

          </tr>
          <tr class="">
            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e289 "><strong class="uicontrol">Access content resources</strong> (<code>content</code>)</td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e292 ">Allows hybrid apps to directly obtain content child sessions through the OAuth
              2.0 hybrid app token flow and hybrid app refresh token flow.</td>

          </tr>
          <tr class="">
            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e289 "><strong class="uicontrol">Access unique user identifiers</strong> (<code>openid</code>)</td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e292 ">
              <p>Allows access to the current, logged in user’s unique identifier for OpenID
                Connect apps.</p>
              <p style="margin-bottom:0;">In the OAuth 2.0 user-agent flow and the OAuth 2.0 web server flow,
                use the <code>openid</code> scope. In addition to the
                access token, this scope enables you to receive a signed ID token that conforms to
                the <a href="http://openid.net/connect/" target="_blank">OpenID Connect
                  specifications</a>.</p>
            </td>

          </tr>
          <tr class="">
            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e289 "><strong class="uicontrol">Full access</strong> (<code>full</code>)</td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e292 ">
              <p>Allows access to all data accessible by the logged-in user, and encompasses all
                other scopes.</p>
              <p style="margin-bottom:0;"><code>full</code> doesn’t return a refresh
                token. You must explicitly request the <code>refresh_token</code> scope to get a refresh token.</p>
            </td>

          </tr>
          <tr class="">
            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e289 "><strong class="uicontrol">Perform requests at any time</strong> (<code>refresh_token, offline_access</code>)</td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e292 ">Allows a refresh token to be returned when the requesting client is eligible to
              receive one. With a refresh token, the app can interact with the user’s data while
              the user is offline. This token is synonymous with requesting <code>offline_access</code>.</td>

          </tr>
          <tr class="">
            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e289 "><strong class="uicontrol">Access Visualforce applications</strong> (<code>visualforce</code>)</td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e292 ">
              <p>Allows access to customer-created Visualforce pages only. This scope doesn’t
                allow access to standard Salesforce UIs.</p>
              <p style="margin-bottom:0;">To allow hybrid apps to directly obtain
                Visualforce child sessions, include this scope with the OAuth 2.0 hybrid app token
                flow or hybrid app refresh token flow.</p>
            </td>

          </tr>
          <tr class="">
            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e289 "><strong class="uicontrol">Manage user data via Web browsers </strong> (<code>web</code>)</td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e292 ">Allows use of the <code>access_token</code> on the web.
              This scope also includes <code>visualforce</code>, allowing
              access to customer-created Visualforce pages.</td>

          </tr>
          <tr class="">
            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e289 "><strong class="uicontrol">Access chatbot services</strong> (<code>chatbot_api</code>)</td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e292 ">Allows access to Einstein Bot API services.</td>

          </tr>
          <tr class="">
            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e289 "><strong class="uicontrol">Access Headless Registration API</strong>
              (user_registration_api)</td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e292 ">Allows access to the API for the Headless Registration Flow. If you set up your
              flow to require authentication, you must pass in an access token that includes this
              scope.</td>

          </tr>
          <tr class="">
            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e289 "><strong class="uicontrol">Access Headless Forgot Password API</strong> (<code>forgot_password</code>)</td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e292 ">Allows access to the API for the Headless Forgot Password Flow. If you set up
              your flow to require authentication, you must pass in an access token that includes
              this scope.</td>

          </tr>
          <tr class="">
            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e289 "><strong class="uicontrol">Access all Data Cloud API resources</strong> (<code>cdp_api</code>)</td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e292 ">Allows access to all Data Cloud API resources.</td>

          </tr>
          <tr class="">
            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e289 "><strong class="uicontrol">Access the Salesforce API Platform</strong> (<code>sfap_api</code>)</td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e292 ">Allows access to the Salesforce API Platform, including API services accessed
              from <samp class="filepath">api.salesforce.com</samp> or the equivalent operating zone
              endpoint.</td>

          </tr>
          <tr class="">
            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e289 "><strong class="uicontrol">Access Interaction API resources</strong> (interaction_api) </td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d56461e292 ">Reserved for future use.</td>

          </tr>
        </tbody>
      </table>

When the client receives an access token, the authorizing server also includes the scopes assigned to the connected app in its response. These scopes are also stored with the refresh token. For JSON or SAML bearer token requests, the request combines the scopes of all previous refresh tokens.

All scope values include `id`, which you can use to access the identity URLs at any time.

This example request includes the `api`, `id`, and `web` scopes. The scope values are separated with the space character, `%20`.

```
https://MyDomainName.my.salesforce.com/services/oauth2/authorize?
response_type=token&
client_id=3MVG9lKcPoNINVBKV6EgVJiF.snSDwh6_2wSS7BrOhHGEJkC_&
redirect_uri=http%3A%2F%2F2www.example.org%2Fqa%2Fsecurity%2Foauth%2Fuseragent_flow_callback.jsp&
scope=api%20id%20web
```