Your users already have a verified digital identity. Your app just has to ask for it.
UAE PASS is the UAE's national digital identity. Instead of building registration, passwords and identity checks, your app sends the user to UAE PASS and gets a verified profile back.
Here's how the flow works, and how I packaged it in OutSystems as UAEPassAuth, a module with two blocks you can drop into any Reactive app.
How it works
UAE PASS sign-in follows the OAuth 2.0 authorization code flow. The browser never sees your client secret or the access token.
- Sign-in. The user clicks the button. The app creates a random
state, saves it in the browser, and redirects to the UAE PASS authorize URL. - Approval. The user approves the request in UAE PASS.
- Callback. UAE PASS redirects back to your page with a short-lived
codeand the samestate, or with anerror. The app comparesstatewith the saved value, which proves the callback belongs to the login this browser started. - Token. Your server exchanges the
codefor an access token, using your client credentials. The code works only once. - User info. Your server calls the userinfo endpoint with the token and receives the profile.
- Authorize: Staging:
https://stg-id.uaepass.ae/idshub/authorize; Production:https://id.uaepass.ae/idshub/authorize - User info: Staging:
https://stg-id.uaepass.ae/idshub/userinfo; Production:https://id.uaepass.ae/idshub/userinfo
The authorize request carries these parameters:
client_id: Your UAE PASS client IDredirect_uri: Your callback pageresponse_type:codestate: A new random value for each loginscope:urn:uae:digitalid:profile:generalacr_values:urn:safelayer:tws:policies:authentication:level:low
What's in the module
UAEPAssSignInblock: Shows the English or Arabic button and starts the redirectUAEPassHandlerblock: Checksstate, exchanges the code, fetches the profile and raises an eventGetUAEPassUserInfoaction: Fetches the profile from a server-side access tokenActionResponsestructure: ReturnsIsSuccessandErrMSG- Site properties: Hold the client IDs, URLs, scope and
IsProduction
Integrating it
1. Get your UAE PASS details
Get a client ID and client secret from UAE PASS, and register your redirect URL with them. Start on staging.
2. Add the dependency
In Manage Dependencies, add the two blocks from UAEPassAuth, along with GetUserinfoResponse if you pass the profile around your app.
3. Configure the environment
In Service Center, open the UAEPassAuth module and set:
IsProduction: Staging:False; Production:Truestg_client_id: Staging: Your staging client ID; Production: Not usedprod_client_id: Staging: Not used; Production: Your production client ID- Token REST client credentials: Staging: Staging ID and secret; Production: Production ID and secret
Keep credentials in Service Center so each environment has its own.
4. Add the button to your login screen
Drop UAEPAssSignIn on the screen and set its inputs:
RedirectURI: the full URL of your callback screen.SignInImageURL: optional. Leave it empty to use the built-in button.
5. Create the callback screen
Create a screen, such as UAEPassCallback, that anonymous users can open. Give it three optional Text input parameters, with these exact names so they pick up the query string:
Drop UAEPassHandler on it and pass them through:
The redirect URL must match exactly in all three places: the sign-in block, the handler and your UAE PASS registration.
6. Handle the result
The handler starts on its own and raises UASPassRedirectHandler with Response and UserInfo. Create a client action for that event:
UserInfo includes:
Sub,Uuid: User identifiersFullnameEN,FullnameAR,FirstnameEN,LastnameEN: Name, with Arabic versions availableEmail,Mobile: Contact detailsIdn,UnifiedID: Emirates ID number and unified IDNationalityEN,Gender: Profile detailsUserType,ProfileType: Account type
Available fields can depend on the user's account, so handle empty values.
Before you go live
- Don't create a session from browser data.
UserInfoarrives in a client action, and anything in the browser can be changed. It's fine for display, but logging a user in must be decided on the server, from a profile the server fetched itself. The module doesn't provide that step yet, so add it before using this for real logins. - Treat the profile as sensitive. Store only what you need, and keep
Idnout of logs. - Check the on-device flow.
acr_valuesis set for the web flow. If you need to hand off to the UAE PASS mobile app, test it, and confirm the value with UAE PASS.
Troubleshooting
- UAE PASS rejects the redirect: The redirect URL isn't registered or doesn't match exactly
Invalid Authentication: The user cancelled or UAE PASS returned an error, orstateis missing or doesn't match; check that the screen passesstateand the user returned in the same browser- Token error after approval: Wrong credentials for the environment, or a mismatched
RedirectURL - Works on staging, fails in production:
IsProduction,prod_client_idor the production credentials aren't set