Authorization

Cleverbase’s Identity Federation service uses OAuth 2.0 for authorization.

GET /oauth2/authorize

Description

Starts the OAuth 2.0 authorization server using an Authorization Code flow, as described in Section 1.3.1 of RFC 6749.
The authorization is returned in the form of an authorization code, which the client SHALL then use to obtain an access token (and id_token) with the oauth2/token method.

Input Parameters

ParameterPresenceValueDescription
response_typeREQUIREDStringMust always be "code".
client_idREQUIREDStringUnique Client Identifier.
redirect_uriOPTIONALStringThe URL to redirect to after the authorization process (defaults to registered redirect).
scopeREQUIREDStringSpace-delimited string. Must contain "openid". May contain additional scopes like "com.cleverbase.proof" and "email".
stateREQUIREDStringUp to 255 bytes of arbitrary data from the client that will be passed back to the redirect URI.
nonceOPTIONALStringString used to associate a Client session with an ID Token, mitigating replay attacks.
ui_localesOPTIONALStringEnd-User's preferred languages and scripts for the UI according to RFC5646. English and Dutch are supported. Default is Dutch if omitted or unsupported language is provided.

Response

ParameterPresenceValueDescription
codeREQUIREDStringThe authorization code generated by the authorization server
stateREQUIREDStringShould match state given in request
errorOPTIONALStringA single error code string
error_descriptionOPTIONALStringHuman-readable text providing additional error information

Error response cases

CaseDisplayed to UserErrorError Description
ChallengeExpiredDe QR code is vervallen. De QR code heeft een beperkte levensduur. Probeer het nog een keer en scan het binnen de 10 minuten.access_deniedauthentication challenge expired
EmailUnverified'Uw email is niet geverifieerd', 'Activeer uw e-mail adres om verder te gaan. Om uw e-mail adres te valideren zoek naar "Verifieer je e-mailadres" in uw inbox en volg de instructies daar.'access_denieduser email is unverified
ConsentExpired'Pincode niet op tijd hebt ingevoerd', 'Wacht niet te lang om de pincode in te voeren, hier staat een tijdslimiet op.'access_deniedconsent request expired
ConsentRejected'U ging niet akkoord met het delen van uw gegevens'access_deniedResource owner rejected consent
ProcessExpired'Tijdslimiet bereikt', 'Deze handeling heeft een beperkte levensduur. Probeer het nog een keer en voer je pincode in binnen de 10 minuten.'access_deniedprocess expired
NonPkioCertificateKan niet verbinden met onze systemen. Er was een technisch probleem aan onze kant, probeer het nog een keer.server_errorn/a
VerificationFailedKan niet verbinden met onze systemen. Er was een technisch probleem aan onze kant, probeer het nog een keer.server_errorn/a
SystemErrorKan niet verbinden met onze systemen. Er was een technisch probleem aan onze kant, probeer het nog een keer.server_errorn/a
ConsentInvalidatedKan niet verbinden met onze systemen. Er was een technisch probleem aan onze kant, probeer het nog een keer.server_errorn/a
AuthenticationFailureKan niet verbinden met onze systemen. Er was een technisch probleem aan onze kant, probeer het nog een keer.server_errorn/a

Examples

  • Service Scope Request

    Minimal request for login only:

    GET /oauth2/authorize?
    response_type=code&
    client_id=<OAuth2_client_id>&
    redirect_uri=<OAuth2_redirect_uri>&
    scope=openid&
    lang=en-US&
    state=12345678&
    nonce=54321
  • Extended Scope Request

    Requesting IDF scopes: "openid email com.cleverbase.personal_info com.cleverbase.id_number":

    GET /oauth2/authorize?
    response_type=code&
    client_id=<OAuth2_client_id>&
    redirect_uri=<OAuth2_redirect_uri>&
    scope=openid email com.cleverbase.personal_info com.cleverbase.id_number&
    lang=en-US&
    state=12345678&
    nonce=54321
  • Service Scope Response
    HTTP/1.1 302 Found
    Location: <OAuth2_redirect_uri>?
    code=FhkXf9P269L8g&
    state=12345678
  • Error Response
    HTTP/1.1 302 Found
    Location: <OAuth2_redirect_uri>?error=invalid_request&
    error_description=Invalid%20Authorization%20Code

POST /oauth2/token

Description

Obtain an OAuth 2.0 bearer access token and ID token from the authorization server by passing the authorization code returned by the authorization server after a successful user authentication, along with the used scope, the client ID and client secret in possession of the client application.

Input Parameters

ParameterPresenceValueDescription
grant_typeREQUIREDStringMust always be "authorization_code"
codeREQUIREDStringCode obtained from the oauth2/authorize step
client_idREQUIREDStringUnique Client Identifier (see Prerequisites)
redirect_uriREQUIREDStringThe URL where the user was redirected after the authorization process completed.

Input Headers

ParameterPresenceValueDescription
AuthorizationREQUIREDStringMust always be Basic Auth – e.g. Basic Y2xpZW50SUQ6cGFzc3dvcmQ (the Base64-encoded value CLIENT_ID:CLIENT_SECRET according to RFC 6749)

Response

ParameterPresenceValueDescription
access_tokenREQUIREDStringThe short-lived access token to be used depending on the scope of the OAuth 2.0 authorization request.
expires_inOPTIONALIntThe lifetime in seconds of the service access token.
id_tokenREQUIREDJWTThe ID Token is a security token in JWT format that claims about the authentication of an end-user by an authorization server when using a client. This includes at least the sub claim containing the pairwise pseudonymous identity of the end-user. Can be parsed using tools like jwt.io.
scopeREQUIREDStringSpace delimited string containing the scope for which authorization was granted.
token_typeREQUIREDStringMust be Bearer

Examples

  • Sample Request
    POST /oauth2/token HTTP/1.1
    Authorization: Basic K3dfKT59SUD8gWghq1ghjuZ
    Content-Type: application/x-www-form-urlencoded
    
    grant_type=authorization_code&
    code=<RESULT_FROM_/oauth2/authorize>&
    client_id=<OAuth2_client_id>&
    client_secret=<OAuth2_client_secret>&
    redirect_uri=<OAuth2_redirect_uri>
  • Sample Response

    Example response when original OAuth/authorize request only contains "openid":

    {
      "access_token": "f0EigERuAYruavv2fwRc4ZJKn1x1Uef8ymarsCqKfJw...",
      "expires_in": 3600,
      "id_token": "<ID_TOKEN_JWT_CONTENT>",
      "scope": "openid",
      "token_type": "bearer"
    }

    Example response when original OAuth/authorize request contained the following scopes "openid email com.cleverbase.personal_info com.cleverbase.id_number":

    {
      "access_token": "rxdF-27ehy4LFSUsh32gVDfN9QpdwqDu-3ZtbVsx5J8...",
      "expires_in": 3600,
      "id_token": "<ID_TOKEN_JWT_CONTENT>",
      "scope": "openid email com.cleverbase.personal_info com.cleverbase.id_number",
      "token_type": "bearer"
    }

ID token validation

Clients MUST validate the ID Token in the Token Response in accordance with OIDC ch. 3.1.3.7.

Missing claims

When claims cannot be shared but are requested by the client, the fields will be omited from the id_token and userinfo response in line with OpenID Connect Specification 3.3.3.6. This means that clients SHOULD expect not all requested claims to be present in the id_token and userinfo response.

User information

The UserInfo Endpoint is an OAuth 2.0 Protected Resource that returns Claims about the authenticated End-User. To obtain the requested Claims about the End-User, the Client makes a request to the UserInfo Endpoint using an Access Token obtained through OpenID Connect Authentication. These Claims are represented by a JSON object that contains a collection of name and value pairs for the Claims.

Note: when this endpoint is used for IDF then optional scopes are required otherwise only a pairwise pseudonymous identifier for the natural person user is returned. See scopes and claims for details

Warning

Currently this feature is only available on the legacy "https://idf.acc.cleverbase.com" host.

See for more information: OpenID Connect.

GET /userinfo

Input headers

ParameterPresenceValueDescription
AuthorizationREQUIREDStringMust always be of type Bearer. Obtained from the "openid" scope OAuth flow. e.g. Bearer 4/CKN69L8gdSYp5_pwH3XlFQZ3ndFhkXf9P2_TiHRG-bA

Response

ParameterPresenceValueDescription
subREQUIREDStringSubject - Identifier for the End-User at the Issuer.
com.cleverbase.proofOPTIONALJSONA JSON array of JSON objects with id, content_type and base64_encoded_content fields. The content should be archived by the relying party and associated with the identifier and the provided content type.
com.cleverbase.last_nameOPTIONALStringLast name of the end-user, as present in the identity document.
given_nameOPTIONALStringGiven name(s) of the end-user, as present in the identity document.
birthdateOPTIONALStringBirthdate of the end-user, as present in the identity document.
com.cleverbase.birthplaceOPTIONALStringBirthplace of the end-user, as present in the identity document.
com.cleverbase.nationalityOPTIONALStringNationality of the end-user, as present in the identity document.
com.cleverbase.document.typeOPTIONALStringDocument type used by the end-user to identify.
com.cleverbase.id_numberOPTIONALStringUnique number of the the identity document used during client registration.
emailOPTIONALStringEnd-user’s preferred email address.
email_verifiedOPTIONALBooleanTrue if the end-user’s email address has been verified.
com.cleverbase.nl_brp_voornaamOPTIONALStringGiven name according to BRP rules.
com.cleverbase.nl_brp_voorvoegselOPTIONALStringPrefix according to BRP rules.
com.cleverbase.nl_brp_geslachtsnaamOPTIONALStringLast name according to BRP rules.
com.cleverbase.nl_brp_geslachtsnaam_zonder_voorvoegselOPTIONALStringLast name without prefix according to BRP rules.
com.cleverbase.id_document_issuance_dateOPTIONALStringID Document date of issuance.
com.cleverbase.id_document_issuance_placeOPTIONALStringID Document place of issuance.
audREQUIREDStringAudience - (for who or what the token is intended for)
auth_timeREQUIREDIntTime when authentication occurred - Unix timestamp
iatREQUIREDIntToken issued at - Unix timestamp
issREQUIREDStringIssuer (who created and signed this token)
ratREQUIREDIntUnkown - Unix timestamp

Sample request

GET /userinfo HTTP/1.1
Authorization: Bearer 4/CKN69L8gdSYp5_pwH3XlFQZ3ndFhkXf9P2_TiHRG-bA
Content-Type: application/json

Sample response

Example response when the original oauth/authorize request only contained the "openid" scope (login functionality only)

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8

{
    "aud": [
        <client_id>
    ],
    "auth_time": 1650458268,
    "iat": 1650458274,
    "iss": "https://esign.acc.cleverbase.com/",
    "rat": 1650458253,
    "sub": "bf70e2da-feff-4c6b-86c2-47eda199ab30"
}

Example response when the original oauth/authorize request contained the scopes "openid email com.cleverbase.personal_info com.cleverbase.id_number":

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8

{
    "aud": [
        <client_id>
    ],
    "auth_time": 1650459478,
    "birthdate": "1990-12-22",
    "com.cleverbase.birthplace": "Rome",
    "com.cleverbase.document.type": "NLD_PASSPORT",
    "com.cleverbase.id_number": "XWN75IM16",
    "com.cleverbase.last_name": "De Bruijn",
    "com.cleverbase.nationality": "NLD",
    "email": "demo.acc.190422.102459@cleverbase.com",
    "email_verified": true,
    "given_name": "Willeke Liselotte",
    "iat": 1650459485,
    "iss": "https://esign.acc.cleverbase.com/",
    "rat": 1650459462,
    "sub": "bf70e2da-feff-4c6b-86c2-47eda199ab30"
}