Skip to main content

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.

Provides utilities to query, request, and revoke access scopes for the app using the Admin API.

() => Promise<>
required

Queries Shopify for the scopes for this app on this shop

(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.

(scopes: string[]) => Promise<>
required

Revokes the provided scopes from this app on this shop

Was this section helpful?

Examples for using App Bridge's Scopes API methods

Was this section helpful?

Query access scopes granted to the app on this store

const { granted } = await shopify.scopes.query();

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

Was this section helpful?

Revoke the granted access to the `read_products` scope

await shopify.scopes.revoke(['read_products']);