Auth0
Authenticate users with Auth0.
Last updated
Was this helpful?
Authenticate users with Auth0.
Last updated
Was this helpful?
Auth0 offers a versatile, ready-to-use solution for integrating authentication and authorization services into your applications.
Auth0 facilitates simplified authentication for users. Instead of having to log in separately to each individual application or platform, users can enter their credentials once and subsequently be authenticated across multiple websites or applications.
The following diagram shows the authentication and authorization flow:
Universal login
A customizable login experience that supports various identity providers.
Social identity providers
Integration with popular social platforms for authentication, including Google, Facebook, Twitter, Twitch and others.
Multi-factor authentication (MFA)
Enhances security by supporting multiple authentication factors, such as SMS, email, or authenticator apps.
Log streaming
Provides logs and monitoring capabilities to track authentication and authorization events for auditing and analysis.
To set up the account:
Register your account at Auth0.
When your account is created, go to the Getting Started section and choose Create Application.
Provide the application name and select Single Page Web Applications.
Choose Create.
When the application is created, provide the following application details to Emporix: domain, client ID, client secret, certificate and redirect URL.
You can find the Domain, Client ID and Client Secret in the Settings tab.
For the certificate go to the bottom of the Settings tab where you can find Advanced Settings. Expand the section, go to Certificates and copy the value of the Signing Certificate.
Redirect URL is the URL of your storefront where the user is redirected after the Auth0 process.
When you provide the values, the configuration is now done on the Emporix side. Wait for the confirmation from us that this part is ready.
When the configuration is ready, you need to configure the allowed-origins and callbacks URL. Go to the Settings tab in you Auth0 account and enter the values in the Application URIs section. The values should point to your storefront, for example:
Allowed Callback URLs - https://storefront.emporix.io/auth0
Allowed Logout URLs - https://storefront.emporix.io
Allowed Web Origins - https://storefront.emporix.io/auth0
To set up your storefront:
To redirect the user to Auth0 page, add a login button to the login page:
AUTH0_DOMAIN - is the Domain value from the Settings tab in your Auht0 account
AUTH0_CLIENT_ID - is the Client ID value from the Settings tab in your Auht0 account
REDIRECT_URI - is the value provided in the Application URI in the Settings tab in your Auth0 account, it should point to a place where user is redirected after the authentication flow
When user finishes the auth flow, Auth0 redirects the user to the URL provided in REDIRECT_URI parameter. It adds an additional query parameter called code
. Having the code value, you need to invoke Emporix API to exchange the Auth0 code with the Emporix token. Apart from the CODE value, you also need Emporix ${ANONYMOUS_TOKEN}.
When you have the two values, invoke the following API:
Response:
Store the access_token
and saas_token
for further communication with Emporix.
Auth0 can be connected with many social apps. When the apps are integrated with Auth0, users can then access your storefront with the social application login.
Twitch is an example of the application that you can integrate with. To configure the setup:
Sign up for a Twitch Developer account.
Set up an application on the Twitch Developer portal. For the detailed instructions, see Twitch's guide on registering an application.
Connect your Twitch application to your Auth0 application. For the detailed instructions, see Auth0's guide on connecting apps to Twitch.
Result: After the configuration, users can now use the Twitch account as a way of logging in.
To check how to obtain the anonymous token from Emporix, check the documentation.