Auth0 is a platform that provides authentication as a service. Instead of managing your own user's credentials, Auth0 can take care of that for you. In this guide, you will learn how you can configure Auth0 as a SAML Identity Provider with Flex. To learn more about how Auth0 works, visit the official Auth0 overview page.
Click the Settings tab and set the Application Callback URL to the appropriate value for your SSO configuration type:
https://login.flex.us1.twilio.com/login/callback?connection=JQxxxx
ACxxxx
with your Account SID, which you can find on the
Twilio Console
.
https://iam.twilio.com/v1/Accounts/ACxxxx/saml2
Copy and paste the appropriate SAML Protocol Settings for your SSO configuration type in the Addons Settings:
Enhanced SSO configuration
1{2"binding": "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST",3"signResponse": true,4"audience": "urn:flex:JQxxxx"5}
Legacy SSO configuration:
1{2"binding": "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST",3"signResponse": true4}
Scroll down to Application URIs, and confirm or add the appropriate value for your SSO configuration type to the Allowed Callback URLs:
https://login.flex.us1.twilio.com/login/callback?connection=JQxxxx
ACxxxx
with your own Account SID.
hhttps://iam.twilio.com/v1/Accounts/ACxxxx/saml2, https://iam.twilio.com/v1/Accounts/ACxxxx/saml2/metadata
Scroll down to Advanced Settings and select the Endpoints tab. Copy the SAML Protocol URL and Save the settings.
Actions are Node.js functions that execute at certain points in Auth0. You can use custom actions to customize or extend Auth0's default capabilities. To learn more about actions and how they work, visit the official Auth0 docs on Auth0 Actions.
In the Actions code editor, add the following code. If you want to send additional attributes to use for routing during login, you can also add them to this definition:
1exports.onExecutePostLogin = async (event, api) => {23api.samlResponse.setAttribute("email", event.user.email || null);4api.samlResponse.setAttribute("full_name", event.user.name || null);5api.samlResponse.setAttribute("image_url", event.user.picture || null);6api.samlResponse.setAttribute("roles", event.user.app_metadata.flex.roles);7}8
Note You will configure the roles property when you add a user in the next section.
Scroll down to app_metadata and assign the required roles (agent, admin or supervisor).
Example:
1{2"flex" : {3"roles" : ["admin"]4}5}
Note If you don't configure the roles for the user, the Post Login action you created in the previous section will fail.
Under X.509 Certificate, copy and paste the contents of the Auth0 certificate you downloaded earlier. You can read the .pem file by using the cat command in your command prompt or terminal. For example:
cat ./name/of/certificate-file.pem
For Single Sign-On URL, paste the url for the SAML Protocol URL that you copied from step 10 of Create an Application on Auth0. Be sure to also append the query string at the end:
?connection=Username-Password-Authentication