Redirect flow
This guide details how to set up regular BankID authentication (High and Biometric) using the Signicat Authentication REST API redirect flow.
Prerequisites
We assume you have done the initial preparations and received the needed access to the service, as described on the Initial preparations page.
Set up the API client
1. Get client credentials
Before you can make a request to the Authentication REST API, you need to set up an API client to obtain client credentials. How to do this is described in Accessing Signicat API products > Set up an API client.
2. Obtain access token
You use the client credentials in a request to obtain an access token. The access token needs to be passed in as an HTTP Bearer authentication header when sending the requests. For more details, see Accessing Signicat API products > Obtaining an access token.
Implement the authentication flow
1. Build the authentication request (CreateSession)
This section describes how to send a request to the CreateSession endpoint, to create a session and start an authentication.
To begin the authentication flow, your application must first start a session by utilising the CreateSession endpoint. The endpoint will automatically create a session when you send a request. The flow and resulting information from the transaction depends on the parameters you pass in the body. The response from this endpoint will contain an authentication URL, to which you can redirect the end-user to start their transaction.
To create a session, send a POST request to https://api.signicat.com/auth/rest/sessions?signicat-accountId={accountId}
.
You can find your accountId
in the Signicat Dashboard.
The following sub-sections show examples and descriptions of attributes that you can include in the request.
Request example
Here is an example request body for an authentication with Norwegian BankID High (BID):
{
"allowedProviders": ["nbid"],
"flow": "redirect",
"additionalParameters": {
"nbid_idp": "BID"
},
"prefilledInput": {
"nin": "17029012345"
},
"requestedAttributes": [
"dateOfBirth",
"firstName",
"lastName",
"name",
"nin"
],
"callbackUrls": {
"success": "https://example.com/success",
"abort": "https://example.com/abort",
"error": "https://example.com/error"
}
}
Upon sending this request, the Norwegian BankID session will start.
If the authentication completes successfully, the final result will contain the attributes that were requested.
Attribute descriptions
To initialise an authentication with Norwegian BankID, you can use the following attributes in the initial request:
For more detailed field descriptions, see the API Reference.
Control the user flow (additionalParameters)
You use additionalParameters
to control the redirect flow. This is not a required field.
Prefill user information (prefilledInput)
You can use the prefilledInput
parameter to prefill information about the user, for example, so the user does not have to fill in this information manually. If prefilled, only the user with the prefilled information will be able to authenticate. This is not a required field.
For Norwegian BankID, you can prefill the national identity number, nin
:
"prefilledInput": {"nin": "17029012345"}
User attributes (requestedAttributes)
You can request the following attributes from users of Norwegian BankID.
Response
Here is an example response after you have created a session:
{
"id": "fb432801-...",
"accountId": "a-sdge-...",
"authenticationUrl": "https://<YOUR_SIGNICAT_DOMAIN>/broker/sp/external-service/login?messageId=21b064c3-28b...",
"status": "CREATED",
"callbackUrls": {
"success": "https://example.com:443/?sessionId=fb432801-66f6-6141-9835-e2a3b42e2e35",
"abort": "https://example.com:443/abort?sessionId=fb432801-66f6-6141-9835-e2a3b42e2e35",
"error": "https://example.com:443/error?sessionId=fb432801-66f6-6141-9835-e2a3b42e2e35"
},
"allowedProviders": [
"nbid"
],
"flow": "redirect",
"requestedAttributes": [
"dateOfBirth",
"firstName",
"lastName",
"name",
"nin"
],
"sessionLifetime": 600
}
What you need to do with the response
You must redirect the end-user to the authenticationUrl
found in the response. This is a unique URL which allows the user to perform the Norwegian BankID authentication in context of the session you just created.
End-user authentication
The end-user follows these steps:
- On your website/application, the end-user clicks on a button to authenticate with BankID. Your application sends a request to start an authentication with BankID, as described in the previous section.
- The end-user is redirected to the BankID login page.
- The end-user logs in using their BankID credentials (this step may involve two-factor authentication).
After the end-user approves the request, the browser is redirected back to the relevant callbackUrl
specified in the CreateSession request.
For screen examples, see About Norwegian BankID.
2. Obtain user information (GetSession)
You use the GetSession endpoint to poll for information regarding the session and ongoing authentication.
Once the authentication is successful, the response will contain the user information requested in the CreateSession call that was done earlier.
Request
No data specific for Norwegian BankID needs to be provided in this request.
To get the status of a session, send a GET request to https://api.signicat.com/auth/rest/sessions/{id}
.
You can find the id
value in the response that was returned when you created the session.
Response
The response contains a status
field, which indicates the current status of the session. Below you can see an example response for a successfully completed session:
{
"id": "fb432801-...",
"accountId": "a-sdge-...",
"authenticationUrl": "https://<YOUR_SIGNICAT_DOMAIN>/broker/sp/external-service/login?messageId=21b064c3-28b...",
"status": "SUCCESS",
"provider": "nbid",
"subject": {
"id": "opuc4kyFUWPkfdmfYTzjS89u6ZCWLHWLZfPR5hpBW24=",
"idpId": "9578-6000-4-1663921",
"name": "Kari Nordmann",
"firstName": "Kari",
"lastName": "Nordmann",
"dateOfBirth": "1990-02-17",
"nin": {
"value": "17029012345",
"issuingCountry": "NO",
"type": "BIRTH"
}
},
"callbackUrls": {
"success": "https://example.com/success?sessionId=58126fb8-c5e2...",
"abort": "https://example.com/abort?sessionId=58126fb8-c5e2...",
"error": "https://example.com/error?sessionId=58126fb8-c5e2..."
},
"allowedProviders": [
"nbid"
],
"flow": "redirect",
"requestedAttributes": [
"dateOfBirth",
"firstName",
"lastName",
"name",
"nin"
],
"sessionLifetime": 600
}
Status overview
What you need to do with the response
If the returned status is SUCCESS, you will find information about the authenticated user in the subject object.
You will also see what identity provider was actually used by checking the provider
field. This can be useful if you allowed more than one identity provider when you created the session.
You have now completed an authentication flow with Norwegian BankID.
Next steps
Learn more about available request and response attributes for Norwegian BankID:
Dive deeper into Authentication REST API and improve your application with advanced security features:
For ecommerce customers under certain conditions, it is also possible to embed the BankID page into your own flow: