> ## 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

`useStytchIsAuthorized` is a hook that returns an authorization verdict on a resource-action pair (that is, whether the logged-in Member (Represents an individual end user's account within a given Organization, uniquely identified within that Organization by their email address.) 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.

## Parameters

**resourceId** `string` *required*

The human-readable ID of the resource to check authorization for.

**action** `string` *required*

The action to take on the specified resource.

## Response

**authorized** `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.

**isInitialized** `boolean`

Whether the SDK has completed initialization.

**fromCache** `boolean`

Whether the authorization data is from persistent storage.

```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>
  );
};
```
