# Conduct a POC with UAE PASS Authentication

The following content provides you a step-by-step guide on conducting a simple POC with UAE PASS Authentication Feature using Postman.

## <mark style="color:orange;">Step 1</mark>

#### <mark style="color:blue;">Set up Staging UAE PASS Account</mark>

Before you begin you must set up a UAE PASS staging account following the steps given in <https://docs.uaepass.ae/start-test-environment-implementation/create-uaepass-user><mark style="color:green;">.</mark>

{% hint style="success" %}
**The account can be either basic or verified. UAE PASS Authentication feature will support SOP1, SOP2 and SOP3 user account types.**
{% endhint %}

## <mark style="color:orange;">Step 2</mark> &#x20;

#### <mark style="color:blue;">Invoke the Authorization Request.</mark>

&#x20;You can use following parameter values for POC purpose.

**Authorize Endpoint=** [<mark style="color:green;">https://stg-id.uaepass.ae/idshub/authorize</mark>](https://stg-id.uaepass.ae/idshub/authorize)

**Client\_id**= <mark style="color:green;">sandbox\_stage</mark>

**Scope** =  <mark style="color:green;">urn:uae:digitalid:profile:general</mark>

**Redirect\_uri**= <mark style="color:green;">For this POC we are using <https://localhost:8000>.</mark>

**acr\_values**= <mark style="color:green;">urn:safelayer:tws:policies:authentication:level:low</mark>

#### Sample Request

{% code overflow="wrap" %}

```url
https://stg-id.uaepass.ae/idshub/authorize?response_type=code&client_id=sandbox_stage&scope=urn:uae:digitalid:profile:general&state=HnlHOJTkTb66Y5H&redirect_uri=https://localhost:8000&acr_values=urn:safelayer:tws:policies:authentication:level:low 
```

{% endcode %}

{% hint style="danger" %}
Authorization request should be invoked in browser to obtain user authorization.
{% endhint %}

Once authorization request is invoked user will get the UAE PASS login page to authorize as follows.&#x20;

<figure><img src="https://4217816688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MekZ3RZxqIxNNSkEFZ1%2Fuploads%2FojK5DvfpTdDoCDsj9mti%2FUAE%20PASS%20Login%20Page.png?alt=media&#x26;token=b94640e1-6f54-4702-87eb-15558a5096dd" alt=""><figcaption><p><mark style="color:green;">UAE PASS Login Page</mark></p></figcaption></figure>

## <mark style="color:orange;">Step 3</mark>

#### <mark style="color:blue;">Enter the identifier of UAE PASS staging account (Email or Mobile or EID) and click on Login.</mark>

&#x20;Once you click on Login button you will receive the UAE PASS authentication notification request to the UAE PASS Staging mobile app and a notification request with a specific code in the browser.&#x20;

<figure><img src="https://4217816688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MekZ3RZxqIxNNSkEFZ1%2Fuploads%2FZbPoyUofX6TAZ69GoTMa%2FUAE%20PASS%20Login%20Page.png?alt=media&#x26;token=fe339262-4cc2-42ed-a4b5-a4827e174486" alt=""><figcaption><p><mark style="color:green;">Enter Identifier and Click Login</mark></p></figcaption></figure>

<figure><img src="https://4217816688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MekZ3RZxqIxNNSkEFZ1%2Fuploads%2FWwACLKktaOcUd4TA3JKx%2FCode%20Page.png?alt=media&#x26;token=eb3bf173-0b43-49e3-84a7-bf726af63de7" alt=""><figcaption><p><mark style="color:green;">Match the Code with Notification Request in Mobile</mark></p></figcaption></figure>

<figure><img src="https://4217816688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MekZ3RZxqIxNNSkEFZ1%2Fuploads%2FK08dWVoiTWQdI3OJYjYa%2FImage%20(11).jpg?alt=media&#x26;token=2cfb84aa-3f5e-4852-b090-810ef459d3fa" alt=""><figcaption><p><mark style="color:green;">Mobile notification Screen</mark></p></figcaption></figure>

## <mark style="color:orange;">Step 4</mark>

#### <mark style="color:blue;">Select the correct code and confirm the notification request.</mark>

<figure><img src="https://4217816688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MekZ3RZxqIxNNSkEFZ1%2Fuploads%2FtS4oO8ZBcTMec5FjhhLR%2FImage%20(10).jpg?alt=media&#x26;token=14b310f9-a2b8-41bf-b9a5-5defe59847b6" alt=""><figcaption></figcaption></figure>

## <mark style="color:orange;">Step 5</mark>

#### <mark style="color:blue;">Obtain Authorization Code</mark>

Once the user accepts the notification request, UAE PASS will issue the authorization code in the response header as shown in below example.

#### Sample Response

```
https://localhost:8080/code-bbc69-344553dc-3445fdscc-HnfgmsfsjjH
```

<figure><img src="https://4217816688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MekZ3RZxqIxNNSkEFZ1%2Fuploads%2FqYIhfTqIRNvH1s1xWn2z%2FAuth%20Code%20Response.png?alt=media&#x26;token=495ad814-344e-43b1-b5cb-36d8b0b542a3" alt=""><figcaption><p><mark style="color:green;"><strong>Authorization Response</strong></mark></p></figcaption></figure>

## <mark style="color:orange;">Step 6</mark>

#### <mark style="color:blue;">Invoke the Access Token Request to obtain the access token.</mark>&#x20;

You can use following values for the POC.

**Token End point** = [<mark style="color:green;">https://stg-id.uaepass.ae/idshub/token</mark>](https://stg-id.uaepass.ae/idshub/token)

**grant\_type** = <mark style="color:green;">authorization\_code</mark>

**redirect\_uri** = <mark style="color:green;">Redirect URL value used in the authorization request (Step 2).</mark>

**code** = <mark style="color:green;">Authorization code received in authorization response.</mark>

**Authorization Header** = <mark style="color:green;">Base64 encoded (client\_ID : client\_Secret)</mark>

<figure><img src="https://4217816688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MekZ3RZxqIxNNSkEFZ1%2Fuploads%2FX8eTiGwAqYgbzdHdxE8Q%2FToken%20API%20Postman1.png?alt=media&#x26;token=1a7fc498-cc66-40ef-b716-b6abec7a6b51" alt=""><figcaption><p><mark style="color:green;">Token API request Parameters</mark></p></figcaption></figure>

<figure><img src="https://4217816688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MekZ3RZxqIxNNSkEFZ1%2Fuploads%2FYtm6oK9WgB9ABwF5WNOV%2FToken%20API%20Postman2.png?alt=media&#x26;token=ce035774-4453-4cd9-93a3-a7d3c4d5ceba" alt=""><figcaption><p><mark style="color:green;"><strong>Token API Authorization Header</strong></mark></p></figcaption></figure>

#### Curl Request for Token API

{% code overflow="wrap" %}

```
curl --location --request POST 'https://stg-id.uaepass.ae/idshub/token?grant_type=authorization_code&redirect_uri=https%3A%2F%2Flocalhost%3A8080&code=bbc69c3b-561b-3cc6-a590-16a2bb8448ed' \
--header 'Authorization: Basic c2FuZGJveF9zdGFnZTpzYW5kYm94X3N0YWdl'
```

{% endcode %}

{% hint style="danger" %}
Token request should be a back-channel request and should use postman or as CURL during the POC to invoke the request.&#x20;
{% endhint %}

{% hint style="success" %}
Authorization code is one time usage value and will expire once used to obtain an access token.  Expiry time will be 10 mins.
{% endhint %}

As success response you will receive an access token from UAE PASS as shown in below image.

<figure><img src="https://4217816688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MekZ3RZxqIxNNSkEFZ1%2Fuploads%2FsgX1SHIUein0tNRToj6k%2FToken%20API%20Response.png?alt=media&#x26;token=5d7d6908-2d5c-4a2e-8c31-f544d8899f79" alt=""><figcaption><p><mark style="color:green;"><strong>Token API response</strong></mark></p></figcaption></figure>

## <mark style="color:orange;">Step 7</mark>

#### <mark style="color:blue;">Invoke the User Info request to obtain the user details of the authenticated user.</mark>&#x20;

You can use following values for the POC.

**User info Endpoint** = <mark style="color:green;"><https://stg-id.uaepass.ae/idshub/userinfo></mark>

**Bearer Token** = <mark style="color:green;">Access token value received from access token response</mark>.

<figure><img src="https://4217816688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MekZ3RZxqIxNNSkEFZ1%2Fuploads%2FqCJ7gOy7siLbq9flJ9E9%2FUser%20Info.png?alt=media&#x26;token=1846fdea-9e68-4054-a24f-e416e3c5f037" alt=""><figcaption><p><mark style="color:green;"><strong>User Info Request</strong></mark></p></figcaption></figure>

#### Curl Request for User Info API

```
curl --location 'https://stg-id.uaepass.ae/idshub/userinfo' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Bearer 221fb1c8-deb7-3fca-b9f6-1d18281f2929'
```

{% hint style="danger" %}
User Info request should be a back-channel request and should use postman or Curl during the POC to invoke the request.&#x20;
{% endhint %}

On success you will receive the user information of the authenticated user from UAE PASS.

<figure><img src="https://4217816688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MekZ3RZxqIxNNSkEFZ1%2Fuploads%2FHCCyaGA3zpy9xHJOMdhc%2FUser%20Info%20Response.png?alt=media&#x26;token=418440d2-9d07-4875-825e-beece3e5aebb" alt=""><figcaption><p><mark style="color:green;"><strong>User Info Response</strong></mark></p></figcaption></figure>

#### <mark style="color:blue;">You can download the postman collection for POC from below attachment.</mark>

{% file src="<https://4217816688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MekZ3RZxqIxNNSkEFZ1%2Fuploads%2FxhXJpjwlmCNq4eYRNubd%2FAuthentication%20APIs%20Postman%20Collection%20V2.postman_collection.json?alt=media&token=c00ee9b9-0be3-49b1-a0cb-f81cb73e0fc2>" %}
