PlatformOutSystems
IntegrationsUAE PASS
Read20 Minute
LevelIntermediate

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.

Infographic of the six UAE PASS sign-in steps, how the state check stops a forged callback, the two OutSystems blocks and the profile data returned.
The UAE PASS sign-in flow, step by step
  • 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 code and the same state, or with an error. The app compares state with the saved value, which proves the callback belongs to the login this browser started.
  • Token. Your server exchanges the code for 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 ID
  • redirect_uri: Your callback page
  • response_type: code
  • state: A new random value for each login
  • scope: urn:uae:digitalid:profile:general
  • acr_values: urn:safelayer:tws:policies:authentication:level:low

What's in the module

  • UAEPAssSignIn block: Shows the English or Arabic button and starts the redirect
  • UAEPassHandler block: Checks state, exchanges the code, fetches the profile and raises an event
  • GetUAEPassUserInfo action: Fetches the profile from a server-side access token
  • ActionResponse structure: Returns IsSuccess and ErrMSG
  • 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: True
  • stg_client_id: Staging: Your staging client ID; Production: Not used
  • prod_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:

Text
1code
2error
3state

Drop UAEPassHandler on it and pass them through:

Text
1code = code
2error = error
3state = state
4RedirectURL = the same URL you used as RedirectURI

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:

Text
1If Response.IsSuccess
2 show or use UserInfo, then continue to your app
3Else
4 show Response.ErrMSG and offer a way to try again

UserInfo includes:

  • Sub, Uuid: User identifiers
  • FullnameEN, FullnameAR, FirstnameEN, LastnameEN: Name, with Arabic versions available
  • Email, Mobile: Contact details
  • Idn, UnifiedID: Emirates ID number and unified ID
  • NationalityEN, Gender: Profile details
  • UserType, 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. UserInfo arrives 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 Idn out of logs.
  • Check the on-device flow. acr_values is 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, or state is missing or doesn't match; check that the screen passes state and 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_id or the production credentials aren't set
Nearby on the map
All solutions
CLOSEDOPENHALF-OPEN
Solution · Distributed Systems

Circuit Breaker in OutSystems

Your banking app is only as fast as the slowest service it calls. A reusable OutSystems circuit breaker that stops one failing partner API from slowing down the whole bank.

Intermediate · 2 min1 file