Scopes
The Scopes API provides the ability to dynamically manage your access scopes within an embedded context.
Tip
To learn more about declaring and requesting access scopes, as well as required vs. optional scopes, refer to manage access scopes.
Anchor to scopesScopes
Provides utilities to query, request, and revoke access scopes for the app using the Admin API.
Anchor to query
query
() => Promise<>
required
Queries Shopify for the scopes for this app on this shop
Anchor to request
request
(scopes: string[]) => Promise<>
required
Requests the merchant to grant the provided scopes for this app on this shop
This will open a permission grant modal for the merchant to accept or decline the scopes.
Anchor to revoke
revoke
(scopes: string[]) => Promise<>
required
Revokes the provided scopes from this app on this shop
Was this section helpful?
Anchor to examplesExamples
Examples for using App Bridge's Scopes API methods
Anchor to example-query-access-scopes-granted-to-the-app-on-this-storeQuery access scopes granted to the app on this store
Was this section helpful?
Query access scopes granted to the app on this store
const { granted } = await shopify.scopes.query();
Anchor to example-requestRequest
Anchor to example-request-the-user-to-grant-access-to-the-`read_products`-scopeRequest the user to grant access to the `read_products` scope
Was this section helpful?
Request the user to grant access to the `read_products` scope
const response = await shopify.scopes.request(['read_products', 'write_discounts']);
if (response.result === 'granted-all') {
// merchant has been granted access — continue
...
}
else if (response.result === 'declined-all') {
// merchant has declined access — handle accordingly
...
}
Preview

Anchor to example-revokeRevoke
Anchor to example-revoke-the-granted-access-to-the-`read_products`-scopeRevoke the granted access to the `read_products` scope
Was this section helpful?
Revoke the granted access to the `read_products` scope
await shopify.scopes.revoke(['read_products']);