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

# useTapAuth

> Returns the install token, the signed-in teammate, the workspace id, the granted scopes and can(scope).

```ts theme={null}
function useTapAuth(): {
  organizationId: string;
  scopes: (
     | "ui:render"
     | "projects:read"
     | "analytics:read"
     | "store.metadata:read"
     | "reviews:read"
     | "crashes:read"
     | "revenue:read"
     | "metrics:write"
     | "alerts:write"
     | "insights:write"
     | "ai:tools"
     | "ai:actions"
     | "store.metadata:write"
     | "autopilot:trigger"
     | "work:create"
     | "work:sync"
     | "storage:write"
     | "messaging:send"
    | "ai:skills")[];
  token: string;
  user: {
     id: string;
     role: "admin" | "member";
  };
  can: boolean;
};
```

Returns the install token, the signed-in teammate, the workspace id, the
granted scopes and `can(scope)`.

## Returns

### organizationId

```ts theme={null}
organizationId: string;
```

### scopes

```ts theme={null}
scopes: (
  | "ui:render"
  | "projects:read"
  | "analytics:read"
  | "store.metadata:read"
  | "reviews:read"
  | "crashes:read"
  | "revenue:read"
  | "metrics:write"
  | "alerts:write"
  | "insights:write"
  | "ai:tools"
  | "ai:actions"
  | "store.metadata:write"
  | "autopilot:trigger"
  | "work:create"
  | "work:sync"
  | "storage:write"
  | "messaging:send"
  | "ai:skills")[];
```

### token

```ts theme={null}
token: string;
```

The install token to send to your own server as a bearer token.

### user

```ts theme={null}
user: {
  id: string;
  role: "admin" | "member";
};
```

#### user.id

```ts theme={null}
id: string;
```

#### user.role

```ts theme={null}
role: "admin" | "member";
```

### can()

```ts theme={null}
can(scope): boolean;
```

Whether the install granted the scope.

#### Parameters

##### scope

\| `"ui:render"`
\| `"projects:read"`
\| `"analytics:read"`
\| `"store.metadata:read"`
\| `"reviews:read"`
\| `"crashes:read"`
\| `"revenue:read"`
\| `"metrics:write"`
\| `"alerts:write"`
\| `"insights:write"`
\| `"ai:tools"`
\| `"ai:actions"`
\| `"store.metadata:write"`
\| `"autopilot:trigger"`
\| `"work:create"`
\| `"work:sync"`
\| `"storage:write"`
\| `"messaging:send"`
\| `"ai:skills"`

#### Returns

`boolean`

## Remarks

Re-renders the component when the host rotates the install token, and when the
signed-in teammate's role arrives after the mount. `scopes` and `can` report the
grant the mount was built with. Throws `TAP_OUTSIDE_HOST` outside a mount.

## Example

```tsx theme={null}
import { TapEmptyState, useTapAuth } from '@tappify/extension-sdk';

function RevenuePanel() {
  const auth = useTapAuth();
  if (!auth.can('revenue:read')) {
    return <TapEmptyState title="Revenue is not shared with this extension" />;
  }
  return <span>Signed in as {auth.user.id}</span>;
}
```
