> For the complete documentation index, see [llms.txt](https://docs.fortifiedid.se/access/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fortifiedid.se/access/key-components/authenticators/credential-validators/bankid/on-another-device.md).

# On another device

This authenticator expects users to input their Swedish personal number, 12 digits only. No "samordningsnummer".

## Configuration

Based on the BankID documentation found here:

<https://www.bankid.com/utvecklare/guider/teknisk-integrationsguide>

{% hint style="info" %}
**Authenticator type:** `BidOnOtherDevice`
{% endhint %}

Common Authenticator configuration can be found [here](/access/key-components/authenticators/common-configuration.md).

{% tabs %}
{% tab title="Properties" %}

<table data-full-width="true"><thead><tr><th>Name</th><th>Description</th><th>Default value</th><th data-type="checkbox">Mandatory</th></tr></thead><tbody><tr><td><code>internal_http_destination</code></td><td>ID of the internal http client used to talk with BankID backend.</td><td><code>"default"</code></td><td>true</td></tr><tr><td><code>mode</code></td><td>Three modes are possible: <code>"production"</code>, <code>"test"</code> &#x26; <code>"custom"</code><em>.</em> Depending on the mode, the URL used to talk to BankID differs.</td><td><code>"production"</code></td><td>false</td></tr><tr><td><code>custom_url</code></td><td>Defines a custom BankID backend URL. Only works if <code>mode</code> is set to <code>"custom"</code><em>.</em></td><td>N/A</td><td>false</td></tr><tr><td><code>custom_identifier</code></td><td>When logging events, the custom_identifier lets you tag the event.</td><td>N/A</td><td>false</td></tr><tr><td><code>requirement</code></td><td>Specifications on client requirements based on BankID relying-party documentation.</td><td>N/A</td><td>true</td></tr><tr><td><code>poll_frequency</code></td><td>How often should client poll for status updates. In seconds.</td><td><code>2</code></td><td>true</td></tr><tr><td><code>allowed_polling_for_minutes</code></td><td>How many minutes is client allowed to keep polling.</td><td><code>2</code></td><td>true</td></tr><tr><td>webroot_dir</td><td>See common authenticator configuration</td><td>web/authenticator/bankid/osd</td><td>false</td></tr></tbody></table>
{% endtab %}

{% tab title="Example" %}

```json
{
	"id": "bidood",
	"type": "BidOnOtherDevice",
	"config": {
		"base_path": "/test/authn",
		"internal_http_destination": "bid",
		"webroot_dir": "web/authenticator/bankid/osd",
		"overlay_dir": "authenticator/bankid/osd/overlay"
	}
}
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
Property *base\_path* should not contain the full path when used in conjunction with the [Selector](/access/key-components/authenticators/flow-control/selector.md), instead, the full URI will be handled by the selector. The full path will be *base\_path + / + id*.
{% endhint %}

## Logging

Apart from system logging, event logging is done when starting, completing, and failing a BankID transaction.

Event ids are:

* WEB\_100001, BankID authentication started
  * IDENTIFIER (user trace id)
  * SOURCE\_ADDRESS (ip address of device starting transaction)
  * SOURCE\_USER\_NAME (personal number)
  * CUSTOMER\_IDENTIFIER (if configured)
  * AUTHENTICATOR\_IDENTIFIER (id and display name)
* WEB\_100002, BankID authentication completed
  * IDENTIFIER (user trace id)
  * SOURCE\_ADDRESS (ip address of the BankID device used)
  * CUSTOMER\_IDENTIFIER (if configured)
  * SOURCE\_USER\_NAME (personal number)
  * AUTHENTICATOR\_IDENTIFIER (id and display name)
  * SURNAME
  * GIVENNAME
* WEB\_100003, BankID authentication failed
  * IDENTIFIER (user trace id)
  * SOURCE\_ADDRESS (ip address of the BankID device used)
  * MESSAGE (information)
  * AUTHENTICATOR\_IDENTIFIER (id and display name)
* WEB\_100004, BankID authentication canceled or expired
  * IDENTIFIER (user trace id)
  * SOURCE\_ADDRESS (ip address of the BankID device used)
  * AUTHENTICATOR\_IDENTIFIER (id and display name)

## Data exposed to global state

After a user completes a transaction, the authenticator is marked as done. Data from the BankID authentication response is then put into the global state:

* givenName
* surname
* name
* personalNumber
* ipAddress
* ocsp
* signature

Note that it is not guaranteed that all parameters hold value.

## API

When communicating with the backend this describes the

### General requirements

Backend communications are made using AJAX and the HTTP PUT method. Every request need a Content-Type with the value of `application/json`*.*

### Getting state

Body must conform to the example below.

```json
{
    "type": "state"
}
```

### Starting an authentication

To start authentication send AJAX request containing the user's "personnummer" (12 digits).

```json
{
    "type": "start",
    "data": {
        "pnr": "<user_data>"
    }
}
```

### Cancel a request

A request can be canceled at any time. This is done by sending a cancel request.

```json
{
    "type": "cancel"
}
```

### Response from server

In general, you should expect a server response with http status code 200. Anything else is to be considered an error.

Response body will be in the form of a JSON object. Typically the response looks like:

```json
{
    "bidstatus": "ABOUT_TO_START"
}
```

The property `"bidstatus"` will contain status.

### Possible status messages

One of the following status codes is returned based on the current state.

* ABOUT\_TO\_START
* PENDING
* COMPLETE
* BID\_ERROR
* ERROR
* OUTSTANDINGTRANSACTION,
* NOCLIENT
* STARTED
* USERSIGN
* EXPIREDTRANSACTION
* STARTFAILED
* CANCELLED
* USERCANCEL
* CERTIFICATEERR

## Translation keys

Default translations provided:

#### English, assets/locales/en.json

```json
{
  "bankid.ood.personal_identity_number": "Personal identity number",
  "bankid.ood.start_authentication": "Start authentication",
  "bankid.ood.open_bankid_app": "Open BankID app",
  "bankid.ood.bankid_app_opened": "BankID app opened",
  "bankid.ood.open_bankid_app_on_this_device": "Log in using BankID on this device",
  "bankid.ood.verify_authentication": "Verifify identification",
  "bankid.ood.authentication_verified": "Identification verified",
  "bankid.ood.redirecting": "Redirecting...",
  "bankid.ood.start_bankid_app": "Start your BankID app.",
  "bankid.ood.cancel": "Cancel",
  "bankid.ood.BID_ERROR": "Unknown error. Please try again.",
  "bankid.ood.ERROR": "Unknown error. Please try again.",
  "bankid.ood.NOCLIENT": "Starting the BankID application failed",
  "bankid.ood.EXPIREDTRANSACTION": "The BankID app is not responding. Please check that the program is started and that you have internet access. If you don’t have a valid BankID you can get one from your bank. Try again.",
  "bankid.ood.STARTFAILED": "The BankID app couldn’t be found on your computer or mobile device. Please install it and order a BankID from your internet bank. Install the app from your app store or https://install.bankid.com.",
  "bankid.ood.CANCELLED": "Action cancelled. Please try again.",
  "bankid.ood.USERCANCEL": "Action cancelled. Please try again.",
  "bankid.ood.CERTIFICATEERR": "The BankID you are trying to use is revoked or too old. Please use another BankID or order a new one from your internet bank.",
  "allow-cookies-body": "To save your language settings on this device you need to approve a language cookie.",
  "allow-cookies-button": "Approve language cookie",
  "authentication.help_text": "",
  "change_language": ""
}
```

#### Swedish, assets/locales/sv.json

```json
{
  "bankid.ood.personal_identity_number": "Personnummer",
  "bankid.ood.start_authentication": "Starta verifiering",
  "bankid.ood.open_bankid_app": "Öppna BankID-appen",
  "bankid.ood.bankid_app_opened": "BankID-appen öppnad",
  "bankid.ood.open_bankid_app_on_this_device": "Logga in med BankID på den här enheten",
  "bankid.ood.verify_authentication": "Verifiera legitimering",
  "bankid.ood.authentication_verified": "Legitimeringen verifierad",
  "bankid.ood.redirecting": "Omdirigerar...",
  "bankid.ood.start_bankid_app": "Starta BankID-appen",
  "bankid.ood.cancel": "Avbryt",
  "bankid.ood.BID_ERROR": "Okänt fel. Försök igen.",
  "bankid.ood.ERROR": "Okänt fel. Försök igen.",
  "bankid.ood.NOCLIENT": "Start av BankID applikationen misslyckades",
  "bankid.ood.EXPIREDTRANSACTION": "BankID-appen svarar inte. Kontrollera att den är startad och att  du har internetanslutning. Om du inte har något giltigt BankID kan du hämta ett hos din Bank. Försök sedan igen",
  "bankid.ood.STARTFAILED": "BankID-appen verkar inte finnas i din dator eller telefon. Installera den och hämta ett BankID hos din internetbank. Installera appen från din appbutik eller https://install.bankid.com.",
  "bankid.ood.CANCELLED": "Åtgärden avbruten. Försök igen",
  "bankid.ood.USERCANCEL": "Åtgärden avbruten. Försök igen",
  "bankid.ood.CERTIFICATEERR": "Det BankID du försöker använda är för gammalt eller spärrat. Använd ett annat BankID eller hämta ett nytt hos din internetbank.",
  "allow-cookies-body": "Vill du spara dina språkinställningar på denna enhet behövs ett godkännande av  språk-cookie.",
  "allow-cookies-button": "Godkänn språk-cookie",
  "authentication.help_text": "",
  "change_language": ""
}

```

## Exposed metric

### Gauges

*ffidAuthnHttp\_pending.name.\<authenticator\_id>\_collect* - indicates how many collect requests hans been sent out and is awaiting response

*ffidAuthnHttp\_pending.name.\<authenticator\_id>\_start* - indicates how many start requests hans been sent out and is awaiting response

### Meters

*ffidAuthnHttp\_failure.name.\<authenticator\_id>\_collect* - indicates number of failed status collects.

*ffidAuthnHttp\_failure.name.\<authenticator\_id>\_start* - indicates number of failed bank id start.

*ffidAuthnHttp\_success.name.\<authenticator\_id>\_start* - indicates number of successful bank id starts

*ffidAuthnHttp\_success.name.\<authenticator\_id>\_collect* - indicates number of successful bank id

collects

### Timers

*ffidAuthnHttp\_request.name.\<authenticator\_id>\_collect -* Tracks the time of a collect round trip.

*ffidAuthnHttp\_request.name.\<authenticator\_id>\_start -* Tracks the time of a collect round trip.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.fortifiedid.se/access/key-components/authenticators/credential-validators/bankid/on-another-device.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
