> ## Documentation Index
> Fetch the complete documentation index at: https://stytch.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# useStytchIsAuthorized Hook

> Check if the current User is authorized for a resource using the Stytch React SDK

export const isReactNative_0 = undefined

`useStytchIsAuthorized` is a hook that returns an authorization verdict on a resource-action pair (that is, whether the logged-in User is authorized to perform the specified action on the specified Resource).

Given a resource and action, this method will return a boolean value, indicating if the User is authorized to perform the action on the resource. Returns `true` if the User can perform the action, `false` otherwise.

If the User is not logged in, this method will always return `false`. If the resource or action provided are not valid for the configured RBAC policy, this method will return `false`.

<Note>
  As a best practice, authorization checks for sensitive actions should also occur on the backend.
</Note>

## Parameters

<ParamField path="resourceId" type="string" required>
  The human-readable ID of the resource to check authorization for.
</ParamField>

<ParamField path="action" type="string" required>
  The action to take on the specified resource.
</ParamField>

## Response

<ResponseField name="isAuthorized" type="boolean" required>
  `true` if the User is authorized to perform the specified action on the specified resource, `false` otherwise. This value may be `false` if the result is from the cache and the underlying data has changed.
</ResponseField>

{!isReactNative_0 && (
<ResponseField name="isInitialized" type="boolean">
  Whether the SDK has completed initialization.
</ResponseField>
)}

<ResponseField name="fromCache" type="boolean">
  Whether the authorization data is from persistent storage.
</ResponseField>

<Panel>
  <RequestExample>
    ```jsx theme={null}
    import { useStytchIsAuthorized } from '@stytch/react';

    export const AdminPanel = () => {
      const { isAuthorized } = useStytchIsAuthorized('documents', 'edit');

      return isAuthorized ? (
        <button>Edit Document</button>
      ) : (
        <p>You don't have permission to edit documents</p>
      );
    };
    ```
  </RequestExample>
</Panel>
