Enrollment Endpoint

The Enrollment endpoint allows adding the authenticator enrollment process to the authentication workflow called by the IdP on the Flow and Code endpoints.

For further information about enrollment workflows, see Add an Enrollment Workflow.

The consent can be customized (labels and description) as described in Customizing the Consent Display.

Copy

The endpoint is exposed at the following URL (and can be obtained from the server discovery endpoint):

https://[base-server-url]/{tenant}/authn/enroll [POST]
Method Details
POST for FIDO
POST for Code
Note: This endpoint currently only supports enrollment for FIDO authenticators.

Enrollment Protection

You can protect the enrollment of the FIDO device-bound or synced passkey with an existing authenticator/credential by defining the type of authenticator and/or require that the user must have an associated pending device in enrollActions.protectionFactor.

Before calling the enrollment flow, the portal validates the protectionFactor with a specific authentication flow.

Copy

Sample request to protect the enrollment action with password

POST https://[base-server-url]/{tenant}/authn/enroll/code
Content-Type: application/x-www-form-urlencoded 
request_uri=urn:hid:43d5b009-7b52-4d6f-a8a9-0d8de27968f9
&grant_type=password
&authType=AT_EMPPWD
&username=testfido &password=54917067

If successfully validated, the portal continues the enrollment flow.

Copy

Sample response

HTTP/1.1 200 OK
server-csrf-token: urn:hid:256ab6ef-12c4-47e3-b220-0e96c161d283
{
    "expires_in": 5184000
}

If the validation fails, enrollment attempts will be rejected by the server.

Copy

Sample error response

HTTP/1.1 400 Bad Request
server-csrf-token: urn:hid:256ab6ef-12c4-47e3-b220-0e96c161d283
{
    "error_description": "Invalid grant: Resource owner username or password is invalid",
    "error": "invalid_grant"
}

Enrollment Flow

  1. The IdP calls the Flow endpoint to get the authentication factors.

  2. HID Authentication Service computes response for the enrollment factor (for example, factor.fido_uaf).

  3. If the factor has enrollActions defined, and the user has a valid authenticator defined by the enrollment factor's upon parameter, the enrollment process is added to the response.

  4. When the authentication portal is rendered, the enrollment link/option is available for the user.

  5. The user authenticates with their valid authenticator and will trigger the enrollment process.

Copy

Sample request to get the publicKeyCredentialOptions for FIDO enrollment (see WebAuthn specifications)

POST https://[base-server-url]/{tenant}/authn/enroll/fido
Content-Type: application/json
{
    "enroll_step": "getcredentialoptions",
    "username": "myuser",
    "request_uri": "urn:hid:8365b59f-ec71-484f-830e-e5a7ce252a13",
    "authType": "AT_FIDO"
}
Copy

Sample response based on configuration (workflow, device type and user info)

HTTP/1.1 200 OK
server-csrf-token: urn:hid:256ab6ef-12c4-47e3-b220-0e96c161d283
{
    "publicKeyCredentialOptions": {
        "attestation": "direct",
        "challenge": "NAb8M_nMQ7eC50gzGOQCljQG_DP5zEO3gudIMxjkApY",
        "authenticatorSelection": {
            "userVerification": "required"
        },
        "user": {
            "displayName": "myuser",
            "name": "myuser",
            "id": "aGppcHVzaA"
        },
        "rp": {
            "name": "auth-service.com"
        }, 
        "pubKeyCredParams": [ 
            { "type": "public-key", "alg": -7 },
            { "type": "public-key", "alg": -35 }, 
            { "type": "public-key", "alg": -36 } 
        ]
    }
}

Where excludeCredentials is a list of credentials that already exist to avoid recreating a new authenticator on same passkey for the same user (see WebAuthn specifications).

WebAuthn then creates the authenticator on the passkey (see WebAuthn specifications), resulting in an iface-pkcredential.

The FIDO credential (credential ID and public key) should then be registered using the JSON-formatted PublicKeyCredential.response (authenticatorattestationresponse).

Copy

Sample request to register the FIDO authenticator (device and credential)

POST https://[base-server-url]/{tenant}/authn/enroll/fido 
server-csrf-token: urn:hid:256ab6ef-12c4-47e3-b220-0e96c161d283
Content-Type: application/x-www-form-urlencoded
{
    "enroll_step": "registercredential",
    "username": "myuser",
    "request_uri": "urn:hid:8365b59f-ec71-484f-830e-e5a7ce252a13",
    "authType": "AT_FIDO",
    "credential": {
        "id": "l0QFH2q-a4mAkn9cIVapKUooA5XuXRW8-tX3Pf0vG6ZbK8WFM1BHYuX_npGi55d4iyYqiM7JF9AfbWaOJURMkwBEnBPYJZJbqM4SCv08T_E",
        "rawId": "l0QFH2q-a4mAkn9cIVapKUooA5XuXRW8-tX3Pf0vG6ZbK8WFM1BHYuX_npGi55d4iyYqiM7JF9AfbWaOJURMkwBEnBPYJZJbqM4SCv08T_E",
        "response": {
            "clientDataJSON": "eyJjaGFsbGVuZ2U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VzdC5jb20vY2VydHMvaGlkZmlkb2NhMi5wN2MwHwYDVR0jBBgwFoAUDLCbuLslcclrOZIz57Fu0imSMQ8wCQYDVR0TBAIwADBDBgNVHR8EPDA6MDigNqA0hjJodHRwOi8vdmFsaWRhdGlvbi5pZGVudHJ1c3QuY29tL2NybC9oaWRmaWRvY2EyLmNybDATBgsrBgEEAYLlHAIBAQQEAwIEMDAdBgNVHQ4EFgQUfYf5Qlnk4jFIUUtbY99YQV2jrq8wIQYLKwYBBAGC5RwBAQQEEgQQaS21SXrlRNWh5d0gpJO3IzAKBggqhkjOPQQDAgNIADBFAiEA6Q2tWWwHwk5QTIg1LgeVx_IZ4WVBdSQrgpnPkoSOGU8CIGvwKQLnS-UfB8Tjh4JPAAPyaYApDJmA0C1atEBeqMa1aGF1dGhEYXRhWNSj_roMlMceufupsoJrPjy45Lz_H1pglUaCkhLlp2A0pUUAAAB1aS21SXrlRNWh5d0gpJO3IwBQl0QFH2q-a4mAkn9cIVapKUooA5XuXRW8-tX3Pf0vG6ZbK8WFM1BHYuX_npGi55d4iyYqiM7JF9AfbWaOJURMkwBEnBPYJZJbqM4SCv08T_GlAQIDJiABIVgg6UMbzPb0PR--eu87XODbaWC1x2fRkN3qrOtK2y3iaK8iWCA5S--zNan7CGoW01PEgu0QnLHpOz3b_d2-5SrFw_hhCg",
            "transports": ["hybrid", "internal"],
        },
        "type": "public-key"
    }

Where the:

  • WebAuthn attestation object is passed in the API 'credential' element

  • Optional transports parameter defines the method to communicate with the authenticator (based on AuthenticatorTransport) to obtain the credential's assertion and platform type

    This parameter can be retrieved from WebAuthn response and is stored in the credential information by HID Authentication Service.

    During the authentication, the parameter allows the browser to detect the FIDO platform and propose the appropriate user experience.

    The possible values are:

    • usb - removable USB device

    • nfc - Near Field Communication (NFC) device

    • ble - Bluetooth Smart (Bluetooth Low Energy / BLE) device

    • smart-card - ISO/IEC 7816 smart card

    • hybrid - a combination of mechanisms such as a computer and smartphone for passkeys

    • internal - non-removable client device-specific transport (see platform authenticators) for passkeys

    Note: If the browser does not support this parameter or the parameter is not present, the behavior of the passkey experience is based on the browser's implementation.
Copy

Sample response

HTTP 201 Created
server-csrf-token": "urn:hid:256ab6ef-12c4-47e3-b220-0e96c161d283

Error Responses

Code Label Possible Errors

400

BAD REQUEST

  • invalid_request

  • invalid_grant

403

FORBIDDEN

access_denied

500

INTERNAL SEVER ERROR

server_error

Copy

Sample error response - invalid request

HTTP/1.1 400 Bad Request
{
    "error_description": "Invalid request : Missing request_uri",
    "error": "invalid_request"
}
Copy

Sample error response - invalid grant

HTTP/1.1 400 Bad Request
{
    "hid_failure": {
        "reason": 17,
        "authType": "AT_FIDO"
    },
    "error_description": "Invalid grant: Resource owner username or password is invalid",
    "error": "invalid_grant"
}
Copy

Sample error response - access denied

HTTP/1.1 403 Forbidden
{
    "error_description": "Access denied by resource owner or authorization server",
    "error": "access_denied"
}