Skip to content

Authorize

The Authorization Endpoint is a standard endpoint that triggers a BankID authentication of an end-user via one of the Identity Providers, following the authorization code flow.

Note

You will always find the up-to-date URL for the Authorization Endpoint in the OpenID Configuration - as authorization_endpoint.

API

Request

GET [authorization_endpoint]
?client_id=myclient-bankid-current
&scope=openid+profile
&redirect_uri=https%3A%2F%2Fmywebapp.example.org%2Fcallback
&response_type=code
&state=01e3ac8e-4a26-4dfb-79ca-2631394c4144
&nonce=1fb72f68-1bea-2ba2-12d7-24df1c999d1b

Parameters

Name Description
client_id Unique ID (arbitrary string) for the OIDC Client in question. This is created as part of the provisioning process.
redirect_uri Redirect URI to which the Authorize response will be sent. This URI must exactly match one of the Redirect URI values for the OIDC Client pre-registered at the OpenID Provider.
scope List of scope values specifying what kind of resources (dataset) the OIDC Client requests access to. The value openid must always be included in the list. Each scope value must be separated by space. Scope values are case-sensitive.
response_type Determines the message flow to be used, thus also governing the content and type of the response from the Authorize endpoint. Only code (Authorization code flow) is supported.
response_mode The response mode to be used for returning parameters from the Authorization Endpoint via redirect_uri. The following values are supported: query, fragment, form_post.
code_challenge Base64-URL-encoded string of the SHA256 hash of a "code verifier" value generated on merchant side. A code verifier is a cryptographically random string using the characters A-Z, a-z, 0-9, and the punctuation characters -._~ (hyphen, period, underscore, and tilde), between 43 and 128 characters long.
code_challenge_method Method used to encode the code verifier. Only "S256" (SHA256) is supported.
state Opaque value used to maintain state between the request and the callback. It is strongly recommended that merchants provide this value to mitigate Cross-Site Request Forgery.
nonce String value used to associate a ODIC Client session with an ID Token, and to mitigate replay attacks. The value is passed through unmodified from the Authentication Request to the resulting ID Token as nonce claim.
ui_locales May be used to set a language preference for GUI handling. The default GUI experience supports: nb (Norsk Bokmål), nn (Norsk Nynorsk) and 'en' (English). If ui_locales is not set, the first (if any) Accept-Language header of the request is used to determine preferred locale. Otherwise nb is used by default.
prompt Support for the standardized values none and login. The former can be used to check for an existing (still valid) authentication session with the OIDC provider. The latter can be used to force a re-authentication, possibly with a different login_hint and/or acr_values. Optional.
acr_values Allow you to determine the a Level of Assurance (LoA) and ACR (Authentication Context Class Reference) value by selecting the Identity provider (IDP) used for authentication. The value is a space-separated list of ACR values, and we support the following values:

- urn:bankid:bis - Biometric authentication using WebAuthn at LoA 3.
- urn:bankid:bid - Authentication using BankID at LoA 4.

If none of these parameters are set, the default LoA is 4 (BankID High).

Note: This parameter has no effect if the login_hint parameter contains a reference to any particular IDP. Nor does it have any effect if the id_token_hint parameter is set.
login_hint This parameter may be used to prefill the user ID in the login form. The value is a colon (:) followed by NNIN (Norwegian National Identity Number).

Example: login_hint=:01010112345

If login_hint contains personal information, it should be encrypted, see details about encryption here.

Note: Previously, login_hint was used to select IDP or LoA, you should instead use acr_values parameter for that purpose.
display The display parameter allows Clients to adjust the user interface displayed to end-users to make it more consistent with the device type and viewport size. We support:

page (default) - standard responsive view (desktops, tablets).
touch - suitable for integration in mobile apps.
wap - same as touch above.
popup - suitable for popup or iframe integrations.
id_token_hint JWT value for an ID Token previously issued by the OIDC Provider used as a hint about the end user's existing session with the OIDC provider. Note that this parameter has precedence before both acr_values and login_hint, but precedence after the prompt parameter.

If the ID Token has expired, a new authentication is triggered for the IDP option that was used when the ID Token was first issued. Otherwise, the authentication is still valid and the OIDC Provider proceeds directly to consent handling.
request This parameter may be used to group and send several query parameters as one. The standard specifies guidelines on how to use it. BankID OIDC supports both plaintext and encrypted request objects.

Encrypted and signed objects are in certain cases possible. If the request parameter contains personal information, it should be encrypted. See encryption.
api_version The version of the API of the BankID OpenID Provider to be used. Integer value. See API versions for more information.
request_uri Only supported when using with Pushed Authorization Requests (PAR) to reference previously pushed request parameters.

Response

After a series of redirects that will eventually lead back to the redirect_uri specified in the request, the response is delivered in the method specified by the response_mode parameter in the request. Typically, as a query parameter in the URL:

[your_web_app]/callback
?state=01e3ac8e-4a26-4dfb-79ca-2631394c4144b
&session_state=12801cef-7746-4dd6-a418-43bda5c7002a
&code=aa47ea38-633d-4e9a-bd41-4f1a5b50fe7c.66801cef-7746-4dd6-4391-43bda5c7002b.0ab47fe7-0376-4b80-b217-065f5a5a3760
Name Description
On success
state The state parameter should be used by the merchant to correlate the initial request and the callback response. It will only be included if provided in the initial request.
code A short-lived, one time use code that is used to retrieve the ID, Access and Refresh tokens using the token endpoint.
On error
state The state parameter should be used by the merchant to correlate the initial request and the callback response. It will only be included if provided in the initial request.
error The error code if the authentication was unsuccessful.
error_description A human-readable description of the error.