Methods
authorize(options)
Redirects to the hosted login page (/authorize
) in order to start a new authN/authZ transaction.
After that, you'll have to use the parseHash
function at the specified redirectUri
.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
|
authorize(options, cb)
Shows inside a new window the hosted login page (/authorize
) in order to start a new authN/authZ transaction and post its result using postMessage
.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
|
||||||||||||||||||||||||||||||||||||||||||||
cb |
authorizeCallback
|
buildAuthorizeUrl(options)
Builds and returns the /authorize
url in order to initialize a new authN/authZ transaction
- Source:
- See:
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
|
buildLogoutUrl(options)
Builds and returns the Logout url in order to initialize a new authN/authZ transaction
If you want to navigate the user to a specific URL after the logout, set that URL at the returnTo parameter. The URL should be included in any the appropriate Allowed Logout URLs list:
- If the client_id parameter is included, the returnTo URL must be listed in the Allowed Logout URLs set at the Auth0 Application level (see Setting Allowed Logout URLs at the App Level).
- If the client_id parameter is NOT included, the returnTo URL must be listed in the Allowed Logout URLs set at the account level (see Setting Allowed Logout URLs at the Account Level).
Parameters:
Name | Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
|
callback(options)
Handles the popup logic for the callback page.
- Source:
- See:
Parameters:
Name | Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
|
callback()
Runs the callback code for the cross origin authentication call. This method is meant to be called by the cross origin authentication callback url.
changePassword(options, cb)
Request an email with instruction to change a user's password
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
|
|||||||||
cb |
changePasswordCallback
|
changePassword(options, cb)
Request an email with instruction to change a user's password
- Source:
- See:
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
|
|||||||||
cb |
changePasswordCallback
|
checkSession(options)
Renews an existing session on Auth0's servers using response_mode=web_message
- Source:
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
|
crossOriginAuthenticationCallback()
Runs the callback code for the cross origin authentication call. This method is meant to be called by the cross origin authentication callback url.
- Deprecated:
- Use
crossOriginVerification
instead.
- Use
- Source:
crossOriginVerification()
Runs the callback code for the cross origin authentication call. This method is meant to be called by the cross origin authentication callback url.
- Source:
delegation(options, cb)
Makes a call to the /delegation
endpoint with either an id_token
or refresh_token
- Source:
- See:
-
- https://auth0.com/docs/api/authentication#delegation
Requires http://auth0.com/oauth/grant-type/password-realm. For more information, read https://auth0.com/docs/clients/client-grant-types.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
|
||||||||||||||||||||||||||||||||
cb |
delegationCallback
|
getSSOData(withActiveDirectories, cb)
Uses checkSession
and localStorage to return data from the last successful authentication request.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
withActiveDirectories |
Boolean
|
this parameter is not used anymore. It's here to be backward compatible |
cb |
function
|
getUser(userId, cb)
Returns the user profile
- Source:
- See:
Parameters:
Name | Type | Description |
---|---|---|
userId |
String
|
identifier of the user to retrieve |
cb |
userCallback
|
linkUser(userId, secondaryUserToken, cb)
Link two users
- Source:
- See:
Parameters:
Name | Type | Description |
---|---|---|
userId |
String
|
|
secondaryUserToken |
String
|
|
cb |
userCallback
|
login(options, cb)
Logs in the user with username and password using the cross origin authentication (/co/authenticate) flow. You can use either username
or email
to identify the user, but username
will take precedence over email
.
Some browsers might not be able to successfully authenticate if 3rd party cookies are disabled in your browser. See here for more information..
After the /co/authenticate call, you'll have to use the parseHash
function at the redirectUri
specified in the constructor.
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
options used in the
|
||||||||||||||||||||
cb |
crossOriginLoginCallback
|
Callback function called only when an authentication error, like invalid username or password, occurs. For other types of errors, there will be a redirect to the |
login(options, cb)
Makes a call to the oauth/token
endpoint with password-realm
grant type
- Source:
- See:
-
Requires
http://auth0.com/oauth/grant-type/password-realm
grant. For more information, read https://auth0.com/docs/clients/client-grant-types.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
|
||||||||||||||||||||||||
cb |
tokenCallback
|
function called with the result of the request |
login(options, cb)
Logs in the user by verifying the verification code (OTP) using the cross origin authentication (/co/authenticate) flow. You can use either phoneNumber
or email
to identify the user.
This only works when 3rd party cookies are enabled in the browser. After the /co/authenticate call, you'll have to use the parseHash
function at the redirectUri
specified in the constructor.
- Source:
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
options used in the
|
||||||||||||||||||||
cb |
crossOriginLoginCallback
|
Callback function called only when an authentication error, like invalid username or password, occurs. For other types of errors, there will be a redirect to the |
login(options, cb)
Logs in the user with username and password using the cross origin authentication (/co/authenticate) flow. You can use either username
or email
to identify the user, but username
will take precedence over email
.
Some browsers might not be able to successfully authenticate if 3rd party cookies are disabled in your browser. See here for more information..
After the /co/authenticate call, you'll have to use the parseHash
function at the redirectUri
specified in the constructor.
- Source:
- See:
-
Requires
Implicit
grant. For more information, read https://auth0.com/docs/clients/client-grant-types.
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
options used in the
|
||||||||||||||||||||
cb |
crossOriginLoginCallback
|
Callback function called only when an authentication error, like invalid username or password, occurs. For other types of errors, there will be a redirect to the |
loginWithCredentials(options, cb)
Performs authentication with username/email and password with a database connection
This method is not compatible with API Auth so if you need to fetch API tokens with audience
you should use authorize
or login
.
- Source:
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
|
||||||||||||||||||||
cb |
credentialsCallback
|
loginWithCredentials(options, cb)
Performs authentication with username/email and password with a database connection inside a new window
This method is not compatible with API Auth so if you need to fetch API tokens with audience
you should use authorize
or login
.
- Source:
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
|
||||||||||||||||||||
cb |
credentialsCallback
|
loginWithCredentials(options, cb)
Logs in the user with username and password using the cross origin authentication (/co/authenticate) flow. You can use either username
or email
to identify the user, but username
will take precedence over email
.
Some browsers might not be able to successfully authenticate if 3rd party cookies are disabled in your browser. See here for more information..
After the /co/authenticate call, you'll have to use the parseHash
function at the redirectUri
specified in the constructor.
- Deprecated:
- This method will be released in the next major version. Use `webAuth.login` instead.
- Source:
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
options used in the
|
||||||||||||||||||||
cb |
crossOriginLoginCallback
|
Callback function called only when an authentication error, like invalid username or password, occurs. For other types of errors, there will be a redirect to the |
loginWithDefaultDirectory(options, cb)
Makes a call to the oauth/token
endpoint with password
grant type to login to the default directory.
- Source:
- See:
-
Requires
password
grant. For more information, read https://auth0.com/docs/clients/client-grant-types.
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
|
||||||||||||||||||||
cb |
tokenCallback
|
function called with the result of the request |
loginWithResourceOwner(options, cb)
Performs authentication calling /oauth/ro
endpoint with username
and password for a given connection name.
This method is not compatible with API Auth so if you need to fetch API tokens with audience
you should use login
or loginWithDefaultDirectory
.
- Source:
Parameters:
Name | Type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
|
||||||||||||||||||||||||
cb |
tokenCallback
|
function called with the result of the request |
logout(options)
Redirects to the auth0 logout endpoint
If you want to navigate the user to a specific URL after the logout, set that URL at the returnTo parameter. The URL should be included in any the appropriate Allowed Logout URLs list:
- If the client_id parameter is included, the returnTo URL must be listed in the Allowed Logout URLs set at the Auth0 Application level (see Setting Allowed Logout URLs at the App Level).
- If the client_id parameter is NOT included, the returnTo URL must be listed in the Allowed Logout URLs set at the account level (see Setting Allowed Logout URLs at the Account Level).
Parameters:
Name | Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
|
parseHash(options, cb)
Parse the url hash and extract the Auth response from a Auth flow started with authorize
Only validates id_tokens signed by Auth0 using the RS256 algorithm using the public key exposed
by the /.well-known/jwks.json
endpoint of your account.
Tokens signed with the HS256 algorithm cannot be properly validated.
Instead, a call to userInfo
will be made with the parsed access_token
.
If the userInfo
call fails, the userInfo
error will be passed to the callback.
Tokens signed with other algorithms will not be accepted.
- Source:
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
|
||||||||||||||||||||
cb |
authorizeCallback
|
passwordlessStart(options, cb)
Starts a passwordless authentication transaction.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
|
||||||||||||||||||||||||
cb |
function
|
passwordlessVerify(options, cb)
Verifies the passwordless TOTP and redirects to finish the passwordless transaction
- Source:
Parameters:
Name | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
|
||||||||||||||||||
cb |
function
|
passwordlessVerify(options, cb)
Verifies the passwordless TOTP and redirects to finish the passwordless transaction
- Source:
Parameters:
Name | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
|
||||||||||||||||||
cb |
function
|
patchUserMetadata(userId, userMetadata, cb)
Updates the user metdata. It will patch the user metdata with the attributes sent.
- Source:
- See:
Parameters:
Name | Type | Description |
---|---|---|
userId |
String
|
|
userMetadata |
Object
|
|
cb |
userCallback
|
preload(options)
Initializes the popup window and returns the instance to be used later in order to avoid being blocked by the browser.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
options |
Object
|
receives the window height and width and any other window feature to be sent to window.open |
renewAuth(options, cb)
Executes a silent authentication transaction under the hood in order to fetch a new tokens for the current session.
This method requires that all Auth is performed with authorize
Watch out! If you're not using the hosted login page to do social logins, you have to use your own social connection keys. If you use Auth0's dev keys, you'll always get login_required
as an error when calling this method.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cb |
authorizeCallback
|
signup(options, cb)
Creates a new user in a Auth0 Database connection
- Source:
- See:
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
|
||||||||||||||||||||
cb |
signUpCallback
|
signup(options, cb)
Creates a new user in a Auth0 Database connection
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
|
||||||||||||
cb |
signUpCallback
|
signupAndAuthorize(options, cb)
Signs up a new user, automatically logs the user in after the signup and returns the user token. The login will be done using /oauth/token with password-realm grant type.
- Source:
- See:
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
|
||||||||||||
cb |
tokenCallback
|
signupAndLogin(options, cb)
Signs up a new user and automatically logs the user in after the signup.
- Source:
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
|
||||||||||||
cb |
credentialsCallback
|
signupAndLogin(options, cb)
Signs up a new user and automatically logs the user in after the signup.
- Source:
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
|
||||||||||||
cb |
crossOriginLoginCallback
|
signupAndLogin(options, cb)
Signs up a new user and automatically logs the user in after the signup.
This method is not compatible with API Auth so if you need to fetch API tokens with audience
you should use authorize
or signupAndAuthorize
.
- Source:
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
|
||||||||||||
cb |
credentialsCallback
|
userInfo(accessToken, cb)
Makes a call to the /userinfo
endpoint and returns the user profile
- Source:
- See:
Parameters:
Name | Type | Description |
---|---|---|
accessToken |
String
|
token issued to a user after Auth |
cb |
userInfoCallback
|
validateAuthenticationResponse(options, cb)
Validates an Auth response from a Auth flow started with authorize
Only validates id_tokens signed by Auth0 using the RS256 algorithm using the public key exposed
by the /.well-known/jwks.json
endpoint of your account.
Tokens signed with the HS256 algorithm cannot be properly validated.
Instead, a call to userInfo
will be made with the parsed access_token
.
If the userInfo
call fails, the userInfo
error will be passed to the callback.
Tokens signed with other algorithms will not be accepted.
- Source:
Parameters:
Name | Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
|
||||||||||||||||
cb |
authorizeCallback
|
Type Definitions
authorizeCallback(erropt, resultopt)
- Source:
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
err |
Error
|
<optional> |
error returned by Auth0 with the reason of the Auth failure |
||||||||||||||||||||
result |
Object
|
<optional> |
result of the Auth request
|
changePasswordCallback(erropt)
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
err |
Error
|
<optional> |
error returned by Auth0 with the reason why the request failed |
credentialsCallback(erropt, resultopt)
- Source:
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
err |
Error
|
<optional> |
error returned by Auth0 with the reason of the Auth failure |
||||||||||||||||
result |
Object
|
<optional> |
result of the AuthN request
|
crossOriginLoginCallback(erropt)
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
err |
Error
|
<optional> |
Authentication error returned by Auth0 with the reason why the request failed |
delegationCallback(erropt, resultopt)
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
err |
Error
|
<optional> |
error returned by Auth0 with the reason why the delegation failed |
result |
Object
|
<optional> |
result of the delegation request. The payload depends on what ai type was used |
signUpCallback(erropt, resultopt)
- Source:
Parameters:
Name | Type | Attributes | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
err |
Error
|
<optional> |
error returned by Auth0 with the reason why the signup failed |
|||||||||
result |
Object
|
<optional> |
result of the signup request
|
tokenCallback(erropt, resultopt)
- Source:
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
err |
Error
|
<optional> |
error returned by Auth0 with the reason of the Auth failure |
||||||||||||||||||||
result |
Object
|
<optional> |
result of the Auth request
|
userCallback(erropt, resultopt)
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
err |
Error
|
<optional> |
failure reason for the failed request to Management API |
result |
Object
|
<optional> |
user profile |
userInfoCallback(erropt, userInfoopt)
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
err |
Error
|
<optional> |
error returned by Auth0 |
userInfo |
Object
|
<optional> |
user information |
validateTokenCallback(erropt, payloadopt)
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
err |
Error
|
<optional> |
error returned by while validating the token |
payload |
Object
|
<optional> |
claims stored in the token |