Set up SSO with Auth0
This guide explains how to set up single sign-on features (SSO) with Auth0
This guide expands Set up SMARTbox.
Create an application in Auth0
To create an application:
- Login to the Auth0
- Open the
Applicationspage - Press the
Create Applicationbutton - Give the name of the application
- Choose the type of application. Consider, Native type
- Press the
Createbutton
After the app is created add the details:
- Application callback URLs:
http://localhost:8888/tenant/my-clinic/patient/auth/callback/? - Press the
Save Changesbutton
Open the Advanced settings of the application and copy:
OAuth Authorization URLOAuth Token URLOAuth User Info URL
Create a user in Auth0
To create a new user:
- Open the
Userspage - Press the
Create Userbutton - Provide email and password
- Press the
Createbutton
Copy the user_id. It looks like auth0|6310e2d143b66b669906d775
Create a Tenant in Aidbox Portal
As the administrator of the Portal create an Tenant resource. Please, see What is Tenant for more details.
id: my-clinic
resourceType: Tenant
name: My Clinic Name
logoUrl: https://example.com/my-clinic-logo.png
identityProvider:
scopes:
- user
- read:org
- openid
- profile
system: aidbox:tenant:my-clinic
userinfo_endpoint: https://dev-nei1uq73.us.auth0.com/userinfo
authorize_endpoint: https://dev-nei1uq73.us.auth0.com/authorize
token_endpoint: https://dev-nei1uq73.us.auth0.com/oauth/token
client:
id: ziW...lv0
secret: 7HoQ...gvb
The URLs copied from the Auth0 are used here:
OAuth Authorization URL as authorize_endpointOAuth Token URL as token_endpointOAuth User Info URL as userinfo_endpoint
It's important to provide the system attribute
Create a user in Aidbox Portal
The user should be linked to a Patient to be able to launch SMART Apps. And at the same time, it should be related to the Auth0 user. Please, see What is Tenant for more details.
id: test-user-1
resourceType: User
identifier:
- value: auth0|6310e2d143b66b669906d775
system: aidbox:tenant:my-clinic
fhirUser:
id: test-pt-1
resourceType: Patient
roles:
- type: patient
active: true
meta:
tenant:
id: my-clinic
resourceType: Tenant
1. identifier contains the link to the Auth0 user 2. fhirUser links the user to the Patient
Checking it works together
- Open the link
https://f81a-5-161-99-84.ngrok.io/tenant/my-clinic/patient/portalin the Invisible (Stealth) mode - Click the
Sign Inlink - Enter
emailandpasswordof the user, we created in the Auth0 - Press the
Loginbutton
Launch the Growth Chart
- On the SMARTbox page
Applications - Press the
Launchbutton against the Growth Chart application - Press the
Allowbutton on the consent screen - Get the Growth Chart works