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

# Is Authorized Sync

> Check if a user has RBAC authorization for specific resources using the Stytch Vanilla JS SDK

`rbac.isAuthorizedSync` is a synchronous method 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).

This method will use locally-cached instances of the User and the configured RBAC policy. If the RBAC policy has not been loaded, this method will always return `false`. See the [SWR caching strategy](https://stytch.com/docs/api-reference/consumer/frontend-sdks/react/resources/swr-and-caching.md).

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

If you need to asynchronously fetch guaranteed-fresh data from the API, use the [`rbac.isAuthorized`](./is-authorized) method.

> [!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 User 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.

```js theme={null}
import { StytchClient } from '@stytch/vanilla-js';

const stytch = new StytchClient('${publicToken}');

const isAuthorized = stytch.rbac.isAuthorizedSync('documents', 'edit');

if (isAuthorized) {
  console.log('User is authorized to edit documents');
} else {
  console.log('User is not authorized to edit documents');
}
```
