Contains all claims from the id_token if available.
The authentication state, true
if the user is authenticated, false
if not.
The loading state of the SDK, true
if the SDK is still processing the PKCE flow, false
if the SDK has finished processing the PKCE flow.
Contains the information of the user if available.
await checkSession();
Check if the user is logged in using getTokenSilently
. The difference
with getTokenSilently
is that this doesn't return a token, but it will
pre-fill the token cache.
This method also heeds the auth0.{clientId}.is.authenticated
cookie, as an optimization
to prevent calling Auth0 unnecessarily. If the cookie is not present because
there was no previous login (or it has expired) then tokens will not be refreshed.
Optional
options: GetTokenSilentlyOptionsFetches a new access token and returns the response from the /oauth/token endpoint, omitting the refresh token.
Fetches a new access token and returns it.
Optional
options: GetTokenSilentlyOptionsconst token = await getTokenWithPopup(options);
Opens a popup with the /authorize
URL using the parameters
provided as arguments. Random and secure state
and nonce
parameters will be auto-generated. If the response is successful,
results will be valid according to their expiration times.
Optional
options: GetTokenWithPopupOptionsOptional
config: PopupConfigOptionsAfter the browser redirects back to the callback page,
call handleRedirectCallback
to handle success and error
responses from Auth0. If the response is successful, results
will be valid according to their expiration times.
Note: The Auth0-Vue SDK handles this for you, unless you set skipRedirectCallback
to true.
In that case, be sure to explicitly call handleRedirectCallback
yourself.
Optional
url: stringtry {
await loginWithPopup(options);
} catch(e) {
if (e instanceof PopupCancelledError) {
// Popup was closed before login completed
}
}
Opens a popup with the /authorize
URL using the parameters
provided as arguments. Random and secure state
and nonce
parameters will be auto-generated. If the response is successful,
results will be valid according to their expiration times.
IMPORTANT: This method has to be called from an event handler that was started by the user like a button click, for example, otherwise the popup will be blocked in most browsers.
Optional
options: PopupLoginOptionsOptional
config: PopupConfigOptionsawait loginWithRedirect(options);
Performs a redirect to /authorize
using the parameters
provided as arguments. Random and secure state
and nonce
parameters will be auto-generated.
Optional
options: RedirectLoginOptions<AppState>logout();
Clears the application session and performs a redirect to /v2/logout
, using
the parameters provided as arguments, to clear the Auth0 session.
Note: If you are using a custom cache, and specifying localOnly: true
, and you want to perform actions or read state from the SDK immediately after logout, you should await
the result of calling logout
.
If the federated
option is specified it also clears the Identity Provider session.
If the localOnly
option is specified, it only clears the application session.
It is invalid to set both the federated
and localOnly
options to true
,
and an error will be thrown if you do.
Read more about how Logout works at Auth0.
Optional
options: LogoutOptions
Contains an error that occured in the SDK