Functionality that cannot be migrated
Not all auth0.js functionality can be directly migrated to auth0-spa-js. Scenarios that cannot be directly migrated include:- embedded login with username/password as well as embedded passwordless login
- user signup
- get a user profile from /userinfo endpoint
- request an email to change the user’s password
- link users with the Management API
- get user with the Management API
- update user attributes with the Management API
- update user metadata with the Management API
- There are also some options that are configurable in Auth0.js that do not have a counterpart in the auth0-spa-js. An example of this is
responseType. There is a reason that there is not a direct 1:1 mapping for each option. In this case,responseTypeis unnecessary, because the SDK is only for use in SPAs, and so one would not need to change the response type.
Authentication Parameters are not modified anymore
Auth0.js converts custom parameters you set fromcamelCase to snake_case internally. For example, if you set deviceType: 'offline', auth0.js actually sends device_type: 'offline' to the server.
When using auth0-spa-js, custom parameters are not converted from camelCase to snake_case. It will relay whatever parameter you send to the .
Create the client
auth0.js
auth0-spa-js
Redirect to the Universal Login Page
auth0.js
auth0-spa-js
Parse the hash after the redirect
auth0.js
auth0-spa-js
Get the user information
auth0.js
TheuserInfo() function makes a call to the /userinfo endpoint and returns the user profile.
auth0-spa-js
Unlike auth0.js, the Auth0 SPA SDK does not call to the/userinfo endpoint for the user profile. Instead Auth0Client.getUser() returns user information from the decoded id_token.
Open the Universal Login Page in a popup
auth0.js
auth0-spa-js
Refresh tokens
auth0.js
auth0-spa-js
The Auth0 SPA SDK handles refresh for you. Every time you callgetTokenSilently, you’ll either get a valid Access Token or an error if there’s no session at Auth0.
Get a token for a different audience or with more scopes
auth0.js
auth0-spa-js
The Auth0 SPA SDK handles Access Token refresh for you. Every time you callgetTokenSilently, you’ll either get a valid Access Token or an error if there’s no session at Auth0.