---
title: useCheckScopesConsent
description: >-
  Returns the current consent status for scopes declared in your Mini's
  manifest.
source_url:
  html: 'https://shopify.dev/docs/api/shop-minis/hooks/util/usecheckscopesconsent'
  md: 'https://shopify.dev/docs/api/shop-minis/hooks/util/usecheckscopesconsent.md'
api_name: shop-minis
---

# useCheckScopesConsent

The `useCheckScopesConsent` hook returns the current consent status for scopes declared in your Mini's [`manifest.json`](https://shopify.dev/docs/api/shop-minis/manifest-file). Use it to decide whether to show the full experience, a gated screen, or a prompt that asks the user to grant access.

Call `refetch()` after `requestScopesConsent()` resolves to read the updated status.

## use​Check​Scopes​Consent()

### Returns

* **UseCheckScopesConsentReturns**

### UseCheckScopesConsentReturns

* error

  ```ts
  Error | null
  ```

* grantedScopes

  Scopes already granted by the user.

  ```ts
  string[] | undefined
  ```

* loading

  ```ts
  boolean
  ```

* refetch

  Re-fetch scope consent status. Call this after \`requestScopesConsent()\` resolves to get the updated status.

  ```ts
  () => Promise<void>
  ```

* requiredScopes

  Required scopes declared by the mini, fetched fresh from the API.

  ```ts
  string[] | undefined
  ```

* status

  Consent status derived from comparing required vs granted scopes. - \`'granted'\` — all required scopes are granted, or none declared - \`'partially\_granted'\` — at least one required scope is granted but not all - \`'not\_granted'\` — no required scopes are granted

  ```ts
  CheckScopesConsentResponse['status'] | undefined
  ```

### CheckScopesConsentResponse

* grantedScopes

  ```ts
  string[]
  ```

* requiredScopes

  ```ts
  string[]
  ```

* status

  ```ts
  'granted' | 'partially_granted' | 'not_granted'
  ```

Examples

### Examples

* ####

  ##### tsx

  ```tsx
  import {useCallback} from 'react'

  import {
    Button,
    useCheckScopesConsent,
    useRequestScopesConsent,
  } from '@shopify/shop-minis-react'

  export default function ConsentGate() {
    const {status, loading, error, refetch} = useCheckScopesConsent()
    const {requestScopesConsent} = useRequestScopesConsent()

    const handleGrantAccess = useCallback(async () => {
      try {
        const {granted} = await requestScopesConsent()
        await refetch()

        console.log(granted ? 'Scope consent granted' : 'Scope consent denied')
      } catch (requestError) {
        console.error('Could not request scope consent:', requestError)
      }
    }, [refetch, requestScopesConsent])

    if (loading) return null

    if (error) {
      return <p>Consent status failed to load.</p>
    }

    if (status === 'granted') {
      return <MainScreen />
    }

    return (
      <div>
        <h1>Grant access</h1>
        <p>Grant access to your order history to personalize your experience.</p>
        <Button onClick={handleGrantAccess}>Grant access</Button>
      </div>
    )
  }

  function MainScreen() {
    return <div>Main experience</div>
  }
  ```

***

## Related

[- useRequestScopesConsent](https://shopify.dev/docs/api/shop-minis/hooks/util/userequestscopesconsent)

[- Scopes consent](https://shopify.dev/docs/api/shop-minis/scopes-consent)

[- Manifest](https://shopify.dev/docs/api/shop-minis/manifest-file)

***
