Skip to main content
Developer

Authorize#

View as Markdown
On this page

The Authorization Endpoint is a standard endpoint⁠ (opens in a new tab) that triggers a BankID authentication of an end-user via one of the Identity Providers, following the authorization code flow.

API#

Request#

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

Query Parameters#

NameDescription
client_idUnique ID (arbitrary string) for the OIDC Client in question. This is created as part of the provisioning process.
redirect_uriRedirect 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.
scopeList 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_typeDetermines 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_modeThe response mode to be used for returning parameters from the Authorization Endpoint via redirect_uri. The following values are supported: query, fragment, form_post.
acr_valuesAllows 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

(request objects/PAR only)
This parameter can be used to prefill the user ID in the login form. The value is a colon (:) followed by NNIN (Norwegian National Identity Number).

Example: :01010112345

Do not send login_hint as query parameter. Use PAR or encrypted request objects.

Note: Previously, login_hint was used to select IDP or LoA; you should instead use the acr_values parameter for that purpose. Warning: Specifying nnin in an unencrypted query param login_hint is not supported in API Version 4.
code_challengeBase64-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_methodMethod used to encode the code verifier. Only "S256" (SHA256) is supported.
stateOpaque 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.
nonceString 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.
api_versionThe version of the API of the BankID OpenID Provider to be used. Integer value. See API versions for more information.
ui_localesMay 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.
promptSupport 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.
displayThe 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.
requestThis parameter may be used to group and send several query parameters as one. The standard⁠ (opens in a new tab) specifies guidelines on how to use it. BankID 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.
request_uriOnly supported when using with Pushed Authorization Requests (PAR) to reference previously pushed request parameters.
authorization_details

(PAR only)
URL-encoded JSON array containing a permission statement. Only accepted in PAR requests. Cannot be used together with permission_token. See Authorization Details for more information.
permission_tokenToken received from the Permissions API after registering a permission. Cannot be used together with authorization_details.
id_token_hintJWT 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.

Encrypted request object#

Instead of sending plain text query parameters you can send an encrypted request object. This will allow you to prefill sensitive data such as NNIN.

Read more here.

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
NameDescription
On success
stateThe 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.
codeA short-lived, one time use code that is used to retrieve the ID, Access and Refresh tokens using the token endpoint.
On error
stateThe 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.
errorThe error code if the authentication was unsuccessful.
error_descriptionA human-readable description of the error.

Was this page helpful?