> ## 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 Member is authorized for a resource using the Stytch Next.js SDK

export const organization = "Represents an instance or tenant in your application, typically mapping to each of your top-level customers.";

export const member = "Represents an individual end user's account within a given Organization, uniquely identified within that Organization by their email address.";

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 <Tooltip tip={member}>Member</Tooltip> 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 Member is authorized to perform the action on the resource.  Returns `true` if the member can perform the action, `false` otherwise.

If the user is not signed 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="authorized" type="boolean" required>
  `true` if the Member is authorized to perform the specified action on the specified resource, `false` otherwise.

  Will resolve to `false` if the RBAC policy has not been loaded or if the resource or action provided are not valid for the configured RBAC policy.
</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/nextjs/b2b';

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

      if (!isInitialized) {
        return <p>Loading...</p>;
      }

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