Skip to main content
Developer

Testing ID-Card API#

View as Markdown
On this page

To be able to test the integration we need a way to create QRCodes on demand. We have therefore made an endpoint that creates QRCodes based on some dummy users. This endpoint is only available in test environment.

Getting Test QR codes#

Use /api/qrtest/{userNumber} to generate QR-Codes that can be scanned. The userNumber should be replaces with on of the pre-defined users bellow.

List of valid test users

User NumberNameGenderDob (yyyy.mm.dd)Age
1EDGAR HETLANDMALE1980-09-0243
2ANNETTE INGVILD BERGANFEMALE1994-09-0229
3JAKOB HALVORSENMALE2010-03-0514
4NORA SOLBERGFEMALE2005-09-1418
5MADS HANSENMALE2009-02-1116

In this example we are getting a QRCode of user number 2.

The response model consists of the QRCode as a byte array. ttl or time to live, this indicates how long the QRCode is valid in seconds. ts is a timestamp of when the QRCode was made in epoch-time. We also return the sessionId embedded in the QRCode as plain text, for the cases where a QRCode scanner is not available during testing.

Postman Collection#

To make it easier, we have created a Postman collection you can use to generate a BankId OIDC Token and test QRCodes as described above.

To use the Postman Collection, you will need to have obtained the client_id and client_secret from us. (Read more)

Setting up the Postman Collection#

  • Open Postman, select 'Import,' and import the collection you downloaded from the link above. Alternatively, you can drag and drop the collection.json file into the Postman window.

  • Fill in missing client_id, client_secret and thescope parameters in the body of the ID-card Test POST as shown bellow: Filling in missing client_id, and client_secret

  • Add QRCode visualization to the Post-Response script of the ID-card Test GET request to display the QRCode

Filling in missing script

Using the Postman Collection#

  1. 1

    Make a call to the ID-card Test POST with client_id, client_secret, and scope to recieve an access_token in the response. step 1

  2. 2

    Use the ID-card Test GET request with the access_token set in the Authorization field using Bearer Token Auth. step 2

  3. 3

    Check the Visualize tab in the Body section to see the QRCode. step 3

Using a QRCode#

Now that we can generate QRCodes, they can be scanned as you would with a real user and get a sessionId. Use that sessionId in api/merchant/session-endpoint to get the user data for that test user.

In this example we have a sessionId for user number 3.

Was this page helpful?