getAuthenticationStatus()
Use nhost.auth.getAuthenticationStatus
to get the authentication status of the user.
If isLoading
is true
, the client doesn't know whether the user is authenticated yet or not
because some internal authentication network requests have not been resolved yet.
const { isAuthenticated, isLoading } = nhost.auth.getAuthenticationStatus()
if (isLoading) {
console.log('Loading...')
}
if (isAuthenticated) {
console.log('User is authenticated')
}