Skip to main content

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.

The connectionAttempts returns the number of times the client has tried to connect to the server with no success (offline, or the server retruned an internal error).

const { isAuthenticated, isLoading } = nhost.auth.getAuthenticationStatus()

if (isLoading) {
console.log('Loading...')
}

if (isAuthenticated) {
console.log('User is authenticated')
}