Authenticate with Swedish BankID using the Nexus XPI Web Service (SOAP) API
This article is valid for Digital Access 6.2 and later
This article describes authenticating with Swedish BankID using the Nexus XPI Web Service (SOAP) API. See also Swedish national eID - BankID and Mobile BankID for more information.
Operations
Method | Request parameters | Response Type | Description |
---|---|---|---|
authenticate | subject, method | Subject | Authenticates a subject using the specified method. |
Authenticate
Request parameters
Name | Type | Required | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
subject | subject
| Y | A subject representing the entity to be authenticated. | ||||||||||||||||||||||||||||||||||||
method | Integer | Y | An integer with the ID of the authentication method to be used. |
Response parameters
Type | Required | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
subject
| Y | The supplied subject populated with username and session principals. |
Faults
Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
WSException
| If general FaultException occurs. | ||||||||||||
AuthenticationException
| If authentication failed. For example, providing an invalid method. | ||||||||||||
ChallengeException
| If additional credentials are required. |
Initial authentication request
Request action | Description | Request example | Response example |
---|---|---|---|
token |
| Request example
CODE
| Response example
CODE
|
Handle token response
Response status | Description | Request example (poll-loop) | Poll response example |
---|---|---|---|
qrcode |
| Example: poll-loop
CODE
| Example: Poll response
CODE
|
Handle poll response
Response status | Description | Request example | Response example |
---|---|---|---|
continue |
| NA | Example: continue
CODE
|
sign |
| NA | Example: sign
CODE
|
showqr |
| Example:
CODE
| Example:
CODE
|
done | If the response subject credentials status is done , then always terminate the poll-loop and perform credentials do-action done . Then follow the instructions in section "Handle done response". | Example
CODE
| Example
CODE
|
Handle done response
Description | Request example | Response example |
---|---|---|
If no exception thrown calling authenticate and the response subject principal’s username has a value then the user is successfully authenticated. If an expected serial number exists, compare it with value in eid-userinfoserialnumber or extract SERIALNUMBER from username manually. See section "User response attributes". | NA | Example
CODE
|
User canceled authentication in the BankID app. The response subject credentials errcode is userCancel. See section "Handle error in done response". | NA | Example
CODE
|
User did not scan QR code and did not launch using a button. After 3 minutes the BankID transaction expires due to inactivity. The response subject credentials See Handle error in done response | NA | Example
CODE
|
User started the BankID app either by scanning QR code or by clicking a button with launch URL. After 3 minutes the BankID transaction expires due to inactivity. The response subject credentials See section "Handle error in done response". | NA | Example
CODE
|
If the user starts two parallel authentications with same BankID. The transaction started first is aborted and returning errcode is The second transaction is also aborted and returning errcode is empty, and errmsg is See section "Handle error in done response". | NA | Example
CODE
|
Handle calc_qr response
Response status | Description | Request example | Response example |
---|---|---|---|
calc_qr | Verify that subject credentials Generate a QR code image on the webpage for the user to scan with the BankID app. Continue performing credentials do-action | Example
CODE
| Example
CODE
|
Handle user cancel
Attribute | Description | Request example | Response example |
---|---|---|---|
cancel | When the user selects to cancel the ongoing authentication process, request the cancel credentials do-action. | Example
CODE
| Example
CODE
|
User response attributes
Attribute | Description | Example value |
---|---|---|
username | Subject of the user's BankID certificate. Only returned when user has authenticated. | CN=Anders Andersson, OID.2.5.4.41=(200811 14.40) Anders Andersson - Mobilt BankID, SERIALNUMBER=199305011612, GIVENNAME=Anders, SURNAME=Andersson, O=Testbank A AB (publ), C=SE |
displayname | Display name from the Subject of the user's BankID certificate. | Anders Andersson |
eid-userinfo-certid | Serial number of the user's BankID certificate. | 8427483655028210100 |
eid-userinfo- commonname | Common name from the Subject of the user's BankID certificate. | Anders Andersson |
eid-userinfo-country | Country from the Subject of the user's BankID certificate. | SE |
eid-userinfo-givenName | Given name from the Subject of the user's BankID certificate. | Anders |
eid-userinfo-issuer | Issuer of the user's BankID certificate. | CN=Testbank A Customer CA3 v1 for BankID Test, SERIALNUMBER=111111111111, O=Testbank A AB (publ), C=SE |
eid-userinfo-notafter | The user's BankID certificate expiry date. | Thu Aug 11 23:59:59 CEST 2022 |
eid-userinfo-notbefore | The user's BankID certificate creation date. | Tue Aug 11 00:00:00 CEST 2020 |
eid-userinfo-organization | Organization from the Subject of the user's BankID certificate. | Testbank A AB (publ) |
eid-userinfoserialnumber | Serial number from the Subject of the user's BankID certificate. | 199305011612 |
eid-userinfo-surname | Surname from the Subject of the user's BankID certificate. | Andersson |
Handle error in done response
Recommendations |
---|
|
General
Topic | Description |
---|---|
Encoding | All binary data is encoded in UTF-8. |
Polling timeout | Using a |
Document scope | Other operations and initial do-actions are not covered in this document. |