<!-- llms.txt: https://workos.com/llms.txt -->
<!-- feedback.md: https://workos.com/docs/feedback.md -->

# Authorization Tokens

Widgets must be supplied with an authorization token. The token can be acquired in one of two ways:

- If you are using the `authkit-js` or `authkit-react` libraries, you can use the provided access token.
- If you use one of our backend SDKs, use the "get token" method in the SDK to request a token with any scopes required by the widget you want to use. Widget tokens expire after one hour.

:::code-group

```js language="js"
const authToken = await workos.widgets.createToken({
  userId: user.id,
  organizationId,
  // scopes corresponds to the permissions required for each widget (see below)
  scopes: ['widgets:users-table:manage', 'widgets:sso:manage'],
});
```

:::

> New WorkOS accounts are created with an "Admin" role that has all Widget permissions assigned. Existing accounts can assign any permissions required by a widget to a role. This can be done on the "Roles" page of the WorkOS Dashboard. See the [Roles and Permissions guide](https://workos.com/docs/authkit/roles-and-permissions) for more information.

For widgets that require permissions, the user must be assigned a role with those permissions before generating a token. No additional permissions are required to view or revoke your own sessions with the [User Sessions widget](https://workos.com/docs/widgets/user-sessions).
