UseAuth
useAuth
Status: Developer Preview
Provides access to the ChannelContext which contains information about the active channel.
Signature
function useAuth(): void
AuthContext
Status: Developer Preview
Signature
interface AuthContext {
status: '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;
}
status
property
'authenticated' | 'verifying' | 'unauthenticated'
authenticationError
property
string
isAuthenticated
property
boolean
login
property
(username: string, password: string, onSuccess?: () => void) => void
logout
property
(onSuccess?: () => void) => Promise<void>
user
property
ResultOf<typeof CurrentUserQuery>['activeAdministrator'] | undefined
channels
property
NonNullable<ResultOf<typeof CurrentUserQuery>['me']>['channels'] | undefined