---
title: "UseAuth"
generated: true
---
<GenerationInfo sourceFile="packages/dashboard/src/lib/hooks/use-auth.tsx" sourceLine="15" packageName="@vendure/dashboard" since="3.3.0" />

Provides access to the <DocsLink href="/reference/dashboard/hooks/use-auth#authcontext">AuthContext</DocsLink> which contains information
about the active channel.

```ts title="Signature"
function useAuth(): void
```
<GenerationInfo sourceFile="packages/dashboard/src/lib/providers/auth.tsx" sourceLine="17" packageName="@vendure/dashboard" since="3.3.0" />

Provides information about the current user & their authentication & authorization
status.

```ts title="Signature"
interface AuthContext {
    status: 'initial' | 'authenticated' | 'verifying' | 'unauthenticated';
    authenticationError?: string;
    isAuthenticated: boolean;
    login: (username: string, password: string, onSuccess?: () => void) => void;
    logout: (onSuccess?: () => void) => Promise<void>;
    user: ResultOf<typeof CurrentUserQuery>['activeAdministrator'] | undefined;
    channels: NonNullable<ResultOf<typeof CurrentUserQuery>['me']>['channels'] | undefined;
    refreshCurrentUser: () => void;
}
```

<div className="members-wrapper">

### status

<MemberInfo kind="property" type={`'initial' | 'authenticated' | 'verifying' | 'unauthenticated'`}   />

The status of the authentication.
### authenticationError

<MemberInfo kind="property" type={`string`}   />

The error message if the authentication fails.
### isAuthenticated

<MemberInfo kind="property" type={`boolean`}   />

Whether the user is authenticated.
### login

<MemberInfo kind="property" type={`(username: string, password: string, onSuccess?: () => void) => void`}   />

The function to login the user.
### logout

<MemberInfo kind="property" type={`(onSuccess?: () => void) => Promise<void>`}   />

The function to logout the user.
### user

<MemberInfo kind="property" type={`ResultOf<typeof CurrentUserQuery>['activeAdministrator'] | undefined`}   />

The user object.
### channels

<MemberInfo kind="property" type={`NonNullable<ResultOf<typeof CurrentUserQuery>['me']>['channels'] | undefined`}   />

The channels object.
### refreshCurrentUser

<MemberInfo kind="property" type={`() => void`}   />

The function to refresh the current user.


</div>
