Skip to main content
The useAuth() hook provides access to the current user’s authentication state.

Returns

An object with the following properties:
isLoading
boolean
A boolean indicating whether the authentication state is still being loaded.
user
User | null
The User object of the currently authenticated user, or null if the user is not authenticated.
isAuthenticated
boolean
A boolean indicating whether the user is authenticated.
login
function
A function that can be called to initiate the login process.
logout
function
A function that can be called to initiate the logout process.

Examples