---
schema_version: "1"
id: 8fa613b9799c1bd36ef8abe7762b4eea3737f1c99df7cf86cbd60e8b2f6fb1a3
title: OauthCustomScope
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/api_meta/meta_oauthcustomscope.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_oauthcustomscope.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 13d84d2af527b445c3e6f881844ccd0bb8ab400e7da185f3466e6ca53b541229
description: Represents a permission defining the protected data that a connected app can access from an external entity when Salesforce is the OAuth authorization provider. This type extends the Metadata metadata type and inherits its fullName field.
---
# OauthCustomScope

Represents a permission defining the protected data that a connected app can access from an external entity when Salesforce is the OAuth authorization provider. This type extends the Metadata metadata type and inherits its fullName field.

![Important](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/images/icon_note_important.png)

#### Important

Where possible, we changed noninclusive terms to align with our company value of Equality. We maintained certain terms to avoid any effect on customer implementations.

## File Suffix and Directory Location

OauthCustomScope components have the suffix .oauthcustomscope and are stored in the oauthcustomscopes directory.

## Version

OAuth custom scopes are available in API version 46.0 and later.

## Special Access Rules

You must have the “Manage Connected Apps” permission to access this object.

## Fields

<table class="featureTable sort_table" summary="">



          <thead class="thead sorted" align="left">
            <tr>
              <th class="featureTableHeader  " id="d705456e100">Field Name</th>

              <th class="featureTableHeader  " id="d705456e103">Field Type</th>

              <th class="featureTableHeader  " id="d705456e106">Description</th>

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d705456e100" data-title="Field Name"><span class="keyword parmname">assignedTo</span></td>

              <td class="entry" headers="d705456e103" data-title="Field Type">
                <span class="ph" id="OauthCustomScopeApp_title"><a name="OauthCustomScopeApp_title"><!-- --></a>OauthCustomScopeApp</span> (enumeration of
                type string)
              </td>

              <td class="entry" headers="d705456e106" data-title="Description">Represents the name of the connected app to which the custom scope is assigned.
                Available in API version 49.0 and later.<p class="p">If the connected app is part of a
                  package, include the package’s namespace prefix with the connected app’s name. Use
                  the following format: <samp class="codeph nolang"><var class="keyword varname">&lt;namespace_prefix&gt;</var>__<var class="keyword varname">&lt;connected_app&gt;</var></samp>.
                  Use two underscores (_) between the namespace prefix and connected app’s
                  name.</p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d705456e100" data-title="Field Name"><span class="keyword parmname">description</span></td>

              <td class="entry" headers="d705456e103" data-title="Field Type">string</td>

              <td class="entry" headers="d705456e106" data-title="Description">Required. The description of the permission provided to the connected app by
                the scope. The custom scope’s description must be unique, can only include
                alphanumeric characters, and can be up to 60 characters long.<div class="p">You can enter a
                  custom label in place of a description. An advantage of using a custom label is
                  that you can maintain reusable text in a single location and translate the text
                  into multiple languages. See <a class="xref" href="https://help.salesforce.com/articleView?id=cl_about.htm&amp;language=en_US" target="_blank">Custom Labels</a>.<div class="box message info">
                    <div class="inner">
                      <div class="bd">
                        <div class="media">
                          <img class="img mtm" src="https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/images/icon_note.png" alt="Note">
                          <div class="mediaBd">
                            <h4 class="mbs">Note</h4>
                            <p>The description formatting
                              requirements that apply to custom scopes also apply to custom
                              labels.</p>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d705456e100" data-title="Field Name"><span class="keyword parmname">developerName</span></td>

              <td class="entry" headers="d705456e103" data-title="Field Type">string</td>

              <td class="entry" headers="d705456e106" data-title="Description">Required. Use when referring to the OAuth custom scope from a program.</td>

            </tr>

            <tr>
              <td class="entry" headers="d705456e100" data-title="Field Name"><span class="keyword parmname">isProtected</span></td>

              <td class="entry" headers="d705456e103" data-title="Field Type">boolean</td>

              <td class="entry" headers="d705456e106" data-title="Description">Required. Indicates whether this component is protected () or not (<samp class="codeph nolang">false</samp>).
                Protected components cannot be linked to or referenced by components created in the
                installing org.</td>

            </tr>

            <tr>
              <td class="entry" headers="d705456e100" data-title="Field Name"><span class="keyword parmname">isPublic</span></td>

              <td class="entry" headers="d705456e103" data-title="Field Type">boolean</td>

              <td class="entry" headers="d705456e106" data-title="Description">Indicates whether the object is included in the connected app’s OpenID Connect
                discovery endpoint. The default setting is <samp class="codeph nolang">false</samp>. For more information, see <a class="xref" href="https://help.salesforce.com/articleView?id=remoteaccess_using_openid_discovery_endpoint.htm&amp;language=en_US" target="_blank">OpenID Connect Discovery Endpoint</a>.</td>

            </tr>

            <tr>
              <td class="entry" headers="d705456e100" data-title="Field Name"><span class="keyword parmname">masterLabel</span></td>

              <td class="entry" headers="d705456e103" data-title="Field Type">string</td>

              <td class="entry" headers="d705456e106" data-title="Description">Required. The primary label for the custom scope record. This label must be
                unique and begin with a letter. It can include only alphanumeric characters and
                underscores. It can’t contain spaces.</td>

            </tr>

          </tbody>

        </table>

## Declarative Metadata Sample Definition

The following is an example of an OAuthCustomScope component. In this example, basicScope is the name of custom scope entity being retrieved.

<?xml version="1.0" encoding="UTF-8"?>
<OauthCustomScope xmlns="http://soap.sforce.com/2006/04/metadata">
    <assignedTo\>
        <connectedApp\>MyOrgNamespace\_\_TestApp</connectedApp\>
    </assignedTo\>
    <description\>Example of a basic custom scope</description\>
    <developerName\>basicScope</developerName\>
    <masterLabel\>basicScope</masterLabel\>
    <isProtected\>false</isProtected\>
    <isPublic\>true</isPublic\>
</OauthCustomScope\>

The following is an example package.xml that references the previous definition.

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types\>
<members\>basicScope</members\>
<name\>OauthCustomScope</name\>
</types\>
<version\>49.0</version\>
</Package\>

## Usage

An OAuth custom scope tells an external entity about a connected app’s permissions to access protected data. The OAuth custom scope you create in your Salesforce org corresponds to the same custom scope defined in your external entity and assigned to the resource.

For example, you define an Order Status custom scope in your external entity that allows access to customer order status data in your order system’s API. In Salesforce, you create an OAuth custom scope that you also name Order Status. You assign this custom scope to the connected app requesting access to the order status API. When the external entity receives the connected app’s request to access a customer’s order status, it validates the connected app’s access token and Order Status scope. With a successful validation, the app can access the customer order status information in the order system’s API.

## Wildcard Support in the Manifest File

This metadata type supports the wildcard character \* (asterisk) in the package.xml manifest file. For information about using the manifest file, see [Deploying and Retrieving Metadata with the Zip File](https://developer.salesforce.com/docs/atlas.en-us.264.0.api_meta.meta/api_meta/file_based_zip_file.htm).