SecureAuth Workforce Authority

User Authentication API

In order to leverage Workforce Authority by SecureAuth to perform Multi-Factor Authentication for existing applications, a set of APIs are provided. The application (or "relying party") authenticates the user internally and then delegates the Smart MFA process to Workforce Authority. This is a three phase process which can be implemented in several different ways to meet the application's requirements.

  • Authentication Request - Details of the user, application, and context are submitted to Workforce Authority to be processed by the risk engine and policy orchestration engine in order to generate a result and an LOA score

  • MFA - The user is required to perform an out of band verification step using Push, SMS, TOTP etc. This step may be bypassed if the Authentication Request is automatically approved by the policy engine

  • Result - The relying party is notified that the MFA phase has been completed and requests the result from Workforce Authority, then allows or blocks user access to the application appropriately

These API calls work with every directory type: the built-in Workforce Authority directory, Active Directory, Microsoft Entra ID, Google Workspace and identity pools. password_login is the exception: it needs a directory that checks passwords, which means Active Directory, Microsoft Entra ID or an identity pool.

Each request uses one directory: the one named by directory_id, if given; otherwise, if your organization has one directory, that one; otherwise the directory whose verified domain matches the user, then the organization's default authentication directory. For password_login and password_less_login, that is the domain of the submitted username. For the other credential types, it is the domains of the user's username and confirmed email addresses; if they match more than one directory, the request gets 401 and multiple_matching_directories. If none applies, the request gets 401 and no_matching_directory. When a user has no Workforce Authority account yet, Workforce Authority creates one on their first authentication if Inline User Provisioning is on for that directory. For the built-in directory, the user's email domain must also be one of your organization's verified domains; otherwise the request gets 400 and ldap_agent_invalid_domain. For oauth_token_login, the federated client's Auto Provision User setting decides instead; when it is off, an unknown user gets 422 and invalid_params.

For the terms this page uses, see the API glossary.

Prerequisites

  • An application in Workforce Authority for the relying party. Its UID and secret are what you request access tokens with.

  • An access token for that application; see Get an access token.

  • At least one directory configured for your organization; for password_login, an Active Directory, Microsoft Entra ID or identity pool directory. To create users on their first authentication, turn on Inline User Provisioning for that directory, or for oauth_token_login, Auto Provision User on the federated client.

How a typical flow works

There are several different ways for a relying party to implement Workforce Authority's Smart MFA; here is one example of the steps in a typical flow.

  1. The user identifies themselves to the relying party; this can be via username and password login or passwordless options such as QR scan login.

  2. The relying party initiates an authentication request with Workforce Authority, including the user identifier and authentication context such as the Device Browser Fingerprint.

  3. Workforce Authority responds to the authentication request with the result of analysis by the risk engine and policy orchestration, including whether the user must perform MFA

  4. The relying party either redirects the user to the Workforce Authority MFA page or provides their own authentication screen, where the user can select an out of band MFA method and provide a verification code or approve a push notification

  5. Workforce Authority notifies the relying party that the authentication request has been resolved and the relying party queries Workforce Authority for the result

  6. The relying party acts based on the authentication result: if it is approved, the user is allowed access to the application but if it is expired or rejected, the user's access is denied

Authenticating to the API

Every request except Get a WebAuthn challenge carries a bearer access token. Get an access token explains how to create an application and request one from your tenant's token endpoint.

This API checks no scope; request the public scope. The token must be issued to the application the user is signing in to. Every request in one user authentication must use a token issued to that same application, though not necessarily the same token.

A missing or invalid token gets 401 Unauthorized with no JSON body. A token from a global OAuth provider your tenant has disabled gets 403 with no body; a token for a disabled tenant gets 401. Only a token without a tenant in its audience, such as a legacy /oauth/token token, gets 404 and not_found when the tenant is disabled, never wrapped in a JWT. Every call answers a parameter that fails validation with 400 and invalid_parameter, and an unexpected failure with 500 and server_error. Once Authenticate a User starts authenticating the user, it answers a missing auth_credentials key with 422 and invalid_params (qr_login answers qr_channel_not_found; without username or directory_id, a password_login or password_less_login in an organization with several directories and no default authentication directory gets 401 and no_matching_directory instead), and an unexpected failure with 500 and general_error.

These endpoints are rate limited; see Rate limits. The 429 body is {"error": "Rate limit exceeded"}, with no response_code. A 503 sent because the rate limit could not be checked has the body {"error": "Rate limit check unavailable"}, also with no response_code.

Responses are plain JSON objects by default. Pass response_format=jwt to receive {"content": "<JWT>"} instead, where the JWT encodes the same object.

Authenticate a User

Initiate a user authentication flow.

Header

Field Type Description
Accept-Language String Preferred language for user-facing messages. Default value: en
HTTP-X-ACCEPTTO-RISK-ENGINE optional json JSON string that will be passed to the risk engine and will be available as authentication_context.http_header_params. Note that the name of the parameter might vary based on your deployment configuration. (Setting.risk_engine_http_header_parameter).

Request

Method URL
POST /api/integration/v2/authn

Parameters

Field Type Description
credential_type String Type of authentication/authorization. Users will see this value as the event type in the mobile app and elsewhere unless a type parameter is specified Allowed values: "password_login" , "password_less_login" , "qr_login" , "webauthn" , "oauth_token_login" , "device_trust_sso".
auth_credentials Object The credential that will be used for authentication. Its keys depend on credential_type; see auth_credentials keys.
session_uid optional String A unique identifier for the session. This is the unique value that the relying party should generate for the lifetime of a session and should be unique across the relying party organization between different applications.
message optional String Message that user receives using push notification on Workforce Authority Mobile app or via text/voice message.
type optional String Type of authentication/authorization. User will see this value as the type of transaction on mobile app. For example: Login , Payment.
auth_factor optional Array Array of strings identifying preferred out of band method to be automatically sent to the user (currently only supports first item). The possible values are: push , symbol_push , sms , text , email , voice , call.
timeout optional Integer The timeout value for the authentication request in seconds; if the user does not respond within the specified time, the request expires. Defaults to the application's out-of-band timeout; when the application sets none, to the global default of 300 seconds (5 minutes).
directory_id optional String ID of the directory to authenticate the user against. When omitted, the organization's only directory is used; with several, the directory whose verified domain matches the user (see the start of this page), then the organization's default authentication directory.
ip_address optional String The end user's IP address, to be used for policy-based risk assessment and logging.
remote_ip_address optional String End user's remote ip address (IP behind proxy) for enabling IP based policies and logging.
totp optional String Users can be authenticated via TOTP by allowing them to enter their time based one-time passcodes while signing in. When TOTP is specified and is correct, the status of the response is approved. If the TOTP is incorrect, the authentication request will be rejected and no other MFA method will be offered.
bfpToken optional String The value of the Workforce Authority DBFP cookie, if in use.
secure_action optional String Marks the request as a security escalation, for policies that match on it. Allowed values: "reset_password".
state optional String An identifier of your own for this sign-in, such as the AD FS activity ID, kept with it.
authn_journey_id optional String The ID of the authentication journey this sign-in belongs to, as a UUID. An ID that matches no journey creates one. An ID that belongs to another user, application or organization returns 400 invalid_journey_id.
authn_journey_timeout optional Integer Seconds before the journey created for authn_journey_id expires. Applies only when the journey is created. Defaults to the deployment's journey timeout, 600 seconds unless changed.
response_format optional String Requested response format. Default value: json. Allowed values: "json" , "jwt".

A parameter that isn't in this table is dropped, so no policy sees it, including a user-defined condition. To keep one, an organization admin adds its name to Extra sign-in metadata keys in Settings, under API. An application's own value, set on its Legacy APIs permissions tab, replaces the organization's rather than adding to it. Names that only Workforce Authority sets, and credential fields, can't be added.

auth_credentials keys

credential_type Keys
password_login username, password
password_less_login username
qr_login qrcode_nonce; optional username, compared case-insensitively with that user's Workforce Authority username; another email address on the account does not match
webauthn credential, origin, challenge_jwt from Get a WebAuthn challenge; optional username, compared case-insensitively with the credential user's Workforce Authority username; another email address on the account does not match
oauth_token_login federated_client_id, plus access_token or id_token, whichever token type that federated client is configured for
device_trust_sso user_id (the user's UUID, as in user_uuid), desktop_sso_nonce

Sample request

{
    "credential_type": "password_less_login",
    "auth_credentials": {
        "username": "abe.lincoln"
    },
    "type": "BillPayment",
    "auth_factor": [
        "push"
    ],
    "bfpToken": "a6a5effa4d8c6xxxx123efed89033ab70ae"
}

Response

Successful response

Field Type Description
success Boolean Shows whether operation was successful or not.
response_code String Returns response code of success.
channel String Uniquely identifies the MFA transaction. Pass it to the send, verify and status calls.
status String Shows status of MFA. The possible values are: pending , expired, approved , rejected , action_required.
session_uid String A unique identifier for the session. This is the unique value that the relying party should generate for the lifetime of a session and should be unique across the relying party organization between different applications.
user_email String Email address of the user that is authenticating.
auth_options Array While the request is pending, the methods the application allows and the user can use for the MFA step: push , symbol_push , fido_push , totp , sms , email , voice , fido_u2f , security_question , policy , static_pin , external_oob , temporary_pin , password , qrcode , federation , device_trust_sso. Once the request is decided, the display name of the method used.
expires_at String Shows expiry time of MFA in ISO 8601 format.
notification_type String The type of notification that has been sent to the user, if any.
symbol_push_answer String The symbol the user must pick for symbol_push; show it to the user.
loa_score Float LOA score of this authentication request.
next_channel optional String Present when status is action_required: the channel of the follow-up request.
action optional String Present when status is action_required: the step required, password_required.

Successful response example

HTTP/1.1 200 OK

{
    "success": true,
    "response_code": "success",
    "channel": "1556910423f49963ade2d1951359b1fe15fcd72c41",
    "status": "pending",
    "session_uid": "aea7f1d0dd368e448e92ac30a5d8e34d",
    "user_email": "abe.lincoln@mailinator.com",
    "auth_options": ["push", "totp"],
    "symbol_push_answer": "A",
    "expires_at": "2020-02-11T18:23:57.000Z",
    "notification_type": null,
    "loa_score": 2.0
}

Unsuccessful response

Error
Field Type Description
response_code String Normalized response code describing the error type.
success Boolean Generally false. Absent on invalid_parameter and server_error.
message String Informative message describing the error.
Response codes

These are the codes an integration commonly meets; others are possible.

Response code Status Description
invalid_parameter 400 A parameter fails validation.
invalid_params 422 A required auth_credentials key is missing, or the WebAuthn credential, federated client or federated token is not accepted.
qr_channel_not_found 422 For qr_login, qrcode_nonce is missing or matches no scanned QR code.
invalid_webauthn_challenge 401 challenge_jwt is expired or invalid.
webauthn_challenge_replay 401 challenge_jwt was already used.
username_mismatch 401 auth_credentials.username does not match, ignoring case, the username of the user who scanned the QR code or owns the WebAuthn credential.
desktop_sso_channel_not_found 422 For device_trust_sso, desktop_sso_nonce is unknown or expired, or user_id does not match it.
no_authenticator_found 422 password_login was requested but the user's directory does not check passwords.
directory_not_found 404 directory_id names no directory in your organization.
no_matching_directory 401 directory_id is omitted, your organization has several directories, no directory's verified domain matches the user, and no default authentication directory is set.
multiple_matching_directories 401 directory_id is omitted and the user's username and confirmed email addresses match more than one directory. Not returned for password_login or password_less_login.
user_not_found 404 The built-in, Microsoft Entra ID or Google Workspace directory has no such user, or the user is not in Workforce Authority and Inline User Provisioning is off for the directory.
ldap_agent_not_found 404 Active Directory or an identity pool has no such user. The message is the same as for ldap_agent_invalid_credentials.
ldap_agent_invalid_credentials 401 The directory rejected the username or password.
disabled_account 401 The user's account is disabled in the directory.
account_locked 401 The user's account is locked in the directory.
password_expired 401 The user's password has expired.
permission_denied 401 The user may not use this application.
no_authn_factor_found 400 The user has no MFA method this application allows.
pair_device 200 The user must pair a device before MFA. success is true, and the body carries no channel; see the example below.
general_error 500 An unexpected failure while authenticating the user.
server_error 500 An unexpected failure before authentication starts.

no_authenticator_found:

HTTP/1.1 422 Unprocessable Entity

{
  "response_code": "no_authenticator_found",
  "success": false,
  "message": "Something went wrong. For help, contact support@example.com."
}

directory_not_found:

HTTP/1.1 404 Not Found

{
  "response_code": "directory_not_found",
  "success": false,
  "message": "Directory not found or you don't have access to it"
}

invalid_parameter:

HTTP/1.1 400 Bad Request

{
  "response_code": "invalid_parameter",
  "message": "Parameter credential_type invalid: Parameter credential_type is required"
}

invalid_params:

HTTP/1.1 422 Unprocessable Entity

{
  "response_code": "invalid_params",
  "success": false,
  "message": "Authentication failed for parameters. For help, contact support@example.com."
}

qr_channel_not_found:

HTTP/1.1 422 Unprocessable Entity

{
  "response_code": "qr_channel_not_found",
  "success": false,
  "message": "Authentication failed for parameters. For help, contact support@example.com."
}

invalid_webauthn_challenge; webauthn_challenge_replay carries the same message:

HTTP/1.1 401 Unauthorized

{
  "response_code": "invalid_webauthn_challenge",
  "success": false,
  "message": "Invalid Passkey challenge"
}

user_not_found:

HTTP/1.1 404 Not Found

{
  "response_code": "user_not_found",
  "success": false,
  "message": "User not found."
}

pair_device. invite_token starts device pairing. user_id and eguardian_user_id both carry the internal user ID. user_attributes holds the user's directory and profile attributes.

HTTP/1.1 200 OK

{
  "response_code": "pair_device",
  "success": true,
  "message": "",
  "invite_token": "eyJpbnZpdGF0aW9uX3Rva2VuIjoixxxx",
  "user_id": 3891,
  "user_uuid": "3f2b8c1e-5d4a-4e9b-8c7d-1a2b3c4d5e6f",
  "user_attributes": {
    "email": "abe.lincoln@mailinator.com"
  }
}

ldap_agent_invalid_credentials:

HTTP/1.1 401 Unauthorized

{
  "response_code": "ldap_agent_invalid_credentials",
  "success": false,
  "message": "Incorrect username or password. Try again."
}

disabled_account:

HTTP/1.1 401 Unauthorized

{
  "response_code": "disabled_account",
  "success": false,
  "message": "User account is disabled."
}

permission_denied:

HTTP/1.1 401 Unauthorized

{
  "response_code": "permission_denied",
  "success": false,
  "message": "Access to this application is restricted for your account."
}

general_error:

HTTP/1.1 500 Internal Server Error

{
  "response_code": "general_error",
  "success": false,
  "message": "Something went wrong. For help, contact support@example.com.",
  "error_details": "error message"
}

server_error:

HTTP/1.1 500 Internal Server Error

{
  "response_code": "server_error",
  "message": "error message"
}

Get a WebAuthn challenge

Issues a signed WebAuthn challenge for a webauthn authentication. The call needs no access token. A browser can call it from the Workforce Authority domain or from an origin your deployment allows; otherwise, call it from your server.

Pass the challenge inside the JWT's payload to the browser's WebAuthn API, then send the JWT unchanged as auth_credentials.challenge_jwt to Authenticate a User. Each JWT works once and expires after 10 minutes by default. Without challenge_jwt, Authenticate a User fails with 500 and server_error.

Request

Method URL
GET /api/integration/v2/authn/webauthn/new

Parameters

Field Type Description
response_format optional String Requested response format. Default value: json. Allowed values: "json" , "jwt".

Response

Successful response

Field Type Description
success Boolean true
response_code String success
challenge_jwt String A JWT signed by Workforce Authority. Its payload holds challenge, the base64url-encoded WebAuthn challenge, plus exp, iat, jti and region.

Successful response example

HTTP/1.1 200 OK

{
    "success": true,
    "response_code": "success",
    "challenge_jwt": "xxxxbGciOiJxxxx.xxxxYWxsZW5nZSI6xxxx.xxxx"
}

Decoded challenge_jwt payload:

{
    "challenge": "PGIvoPG2N-r43Kl6g8_On1CRwYfmdvdaYC9MINb_wS0",
    "exp": 1739486653,
    "jti": "0c10444f-f8b6-4eb0-8aad-b87051b21602",
    "region": "us-east-1",
    "iat": 1739486053
}

Send Out of Band

Send out of band MFA request to user.

Header

Field Type Description
Accept-Language String Preferred language for user-facing messages. Default value: en

Request

Method URL
POST /api/integration/v2/authn/{channel}/factors/{type}/send

Parameters

Field Type Description
type String Out of band method to be sent to user. Allowed values: "push" , "symbol_push" , "sms" , "email" , "voice".
response_format optional String Requested response format. Default value: json. Allowed values: "json" , "jwt".
channel String The channel returned from a successful authentication request, uniquely identifying the MFA transaction.

Response

Successful response

Field Type Description
response_code String Returns response code. The possible values are: push_sent , symbol_push_sent , sms_sent , email_sent , call_sent.
success Boolean Shows whether operation was successful or not.
status String Shows status of MFA. The possible values are: pending , expired, approved , rejected.
expires_at String Shows expiry time of MFA in ISO 8601 format.
notification_type String Notification type sent to user. The possible values are: sms , email , call , push , symbol_push.
message String Message that can be shown to end-user.

Successful response example

HTTP/1.1 200 OK

{
    "response_code": "sms_sent",
    "success": true,
    "status": "pending",
    "expires_at": "2020-02-11T18:23:57Z",
    "notification_type": "sms",
    "message": "We've sent you a 6-digit passcode in a text message."
}

Unsuccessful response

Error
Field Type Description
response_code String Normalized response code describing the error type.
success Boolean Generally false. Absent on invalid_parameter and server_error.
message String Informative message describing the error.
status String Status of the MFA. Absent on invalid_parameter, server_error and tfa_not_found.
expires_at String Expiry time of the MFA in ISO 8601 format. Absent on invalid_parameter, server_error and tfa_not_found.
notification_type String or null The authentication request's current notification type, such as sms, push or totp. On mfa_invalid_state it can be the method that resolved the request, such as static_pin, temporary_pin or security_key. null if none was set. Absent on invalid_parameter, server_error and tfa_not_found.
Response codes
Response code Description
mfa_invalid_state Authentication request is no longer valid, no OOB sent.
not_allowed Authentication method not allowed for this application and user.
wait_for_resend Must wait to re-send OOB notification.
tfa_not_found No TFA with the given channel found for this application.

mfa_invalid_state:

HTTP/1.1 200 OK

{
  "response_code": "mfa_invalid_state",
  "success": false,
  "message": "Your authentication request is no longer valid. Try to log in again.",
  "expires_at": "2020-02-11T18:23:57Z",
  "notification_type": "sms",
  "status": "expired"
}

not_allowed:

HTTP/1.1 200 OK

{
  "response_code": "not_allowed",
  "success": false,
  "message": "Authentication method is not allowed for this application and user.",
  "expires_at": "2020-02-11T18:23:57Z",
  "notification_type": null,
  "status": "pending"
}

wait_for_resend:

HTTP/1.1 200 OK

{
  "response_code": "wait_for_resend",
  "success": false,
  "message": "Too many MFA requests. Before requesting a new SMS, wait 22 seconds.",
  "expires_at": "2020-02-11T18:23:57Z",
  "notification_type": "sms",
  "status": "pending"
}

tfa_not_found:

HTTP/1.1 404 Not Found

{
  "response_code": "tfa_not_found",
  "success": false,
  "message": "No authentication request found for this user with the specified channel."
}

Verify Factor

Verifies the credential of the chosen authentication factor type.

Header

Field Type Description
Accept-Language String Preferred language for user-facing messages. Default value: en.

Request

Method URL
POST /api/integration/v2/authn/{channel}/factors/{type}/verify

Parameters

Field Type Description
type String Not checked. Any value is accepted; the code is tried as a TOTP code, a sent passcode, a static PIN and a temporary PIN.
response_format optional String Requested response format. Default value: json. Allowed values: "json" , "jwt".
channel String The channel returned from a successful authentication request, uniquely identifying the MFA transaction.

Request body

Field Type Description
factor_response Object Object with factor verifier details.
factor_response.code String Authentication factor code. This is the passcode entered by the user to verify the MFA.

Sample request

{
    "factor_response": {
        "code": "123456"
    }
}

Response

Successful response

Field Type Description
success Boolean Shows whether the API call was successful or not.
response_code String Returns response code of success.
status String Shows status of MFA. The possible values are: pending , expired, approved , rejected.
message String Message that explains success.
retry_attempts_remaining Integer The number of attempts remaining to verify factor.
Successful response example
HTTP/1.1 200 OK

{
    "response_code": "success",
    "success": true,
    "status": "approved",
    "message": "Your authorization request is successful.",
    "retry_attempts_remaining": 3
}

Unsuccessful response

Error
Field Type Description
response_code String Normalized response code describing the error type.
success Boolean Generally false. Absent on invalid_parameter and server_error.
message String Informative message describing the error.
status String Status of the MFA. Absent on invalid_parameter, server_error and tfa_not_found.
retry_attempts_remaining Integer The number of attempts remaining to verify the factor. Absent on invalid_parameter, server_error and tfa_not_found, and on mfa_invalid_state when the request was no longer pending on arrival.
Response codes
Response code Description
mfa_invalid_state The authentication request is no longer pending (approved, rejected or expired), or it expired while being approved.
method_not_allowed The passcode matched, but that method is not allowed for this application and user. The authentication request is rejected.
invalid_otp Invalid passcode specified.
max_retry No attempts are left. Either this passcode was invalid and used the last one, or earlier attempts had used them all and the passcode wasn't checked. The authentication request is rejected.
tfa_not_found No TFA with the given channel found for this application.

mfa_invalid_state:

HTTP/1.1 200 OK

{
    "response_code": "mfa_invalid_state",
    "success": false,
    "message": "Your authentication request is no longer valid. Try to log in again.",
    "status": "expired"
}

invalid_otp:

HTTP/1.1 200 OK

{
    "response_code":"invalid_otp",
    "success": false,
    "message":"Passcode is not correct. Try again.",
    "status": "pending",
    "retry_attempts_remaining": 2
}

max_retry:

HTTP/1.1 200 OK

{
    "response_code": "max_retry",
    "success": false,
    "message":"Maximum PIN attempts exceeded. Authorization request denied.",
    "status": "rejected",
    "retry_attempts_remaining": 0
}

tfa_not_found:

HTTP/1.1 404 Not Found

{
    "response_code": "tfa_not_found",
    "success": false,
    "message": "No authentication request found for this user with the specified channel."
}

Status

Checks and returns authentication result status based on channel.

Header

Field Type Description
Accept-Language String Preferred language for user-facing messages. Default value: en.

Request

Method URL
GET /api/integration/v2/authn/{channel}/status

Parameters

Field Type Description
channel String The channel returned from a successful authentication request, uniquely identifying the MFA transaction.
response_format optional String Requested response format. Default value: json. Allowed values: "json" , "jwt".

Response

Successful response

Field Type Description
success Boolean Whether the API call was successful or not.
response_code String Normalized response code describing the error type or "success".
status String Shows status of MFA. The possible values are: pending , expired, approved , rejected , action_required.
channel String The channel uniquely identifying the TFA.
out_of_band_method String Name of the out-of-band method used, such as push or totp, or null.
user_id Integer Internal user ID.
user_uuid String The user's UUID.
expires_at String The TFA expiry in ISO 8601 format.
session_uid String Unique user session identifier.
loa_score Float LOA score of this authentication request.
next_channel optional String Present when status is action_required: the channel of the follow-up request.
action optional String Present when status is action_required: the step required, password_required.

Successful response example

HTTP/1.1 200 OK

{
    "success": true,
    "response_code": "success",
    "status": "approved",
    "channel": "1556910423f49963ade2d1951359b1fe15fcd72c41",
    "out_of_band_method": "push",
    "user_id": 3891,
    "user_uuid": "3f2b8c1e-5d4a-4e9b-8c7d-1a2b3c4d5e6f",
    "expires_at": "2020-02-11T18:23:57.000Z",
    "session_uid": "aea7f1d0dd368e448e92ac30a5d8e34d",
    "loa_score": 2.0
}

Unsuccessful response

Error
Field Type Description
response_code String Normalized response code describing the error type.
success Boolean Generally false. Absent on invalid_parameter and server_error.
message String Informative message describing the error.
Response codes
Response code Description
tfa_not_found No TFA with the given channel found for this application.

tfa_not_found:

HTTP/1.1 404 Not Found

{
  "response_code": "tfa_not_found",
  "success": false,
  "message": "No authentication request found for this user with the specified channel."
}

OAuth calculate LOA score (Risk Engine)

If your organization and relying party application both have access to a standalone risk engine license, the relying party application can submit raw request information to the Workforce Authority API to calculate the LOA score for the current session.

To calculate the LOA score, it takes user data from the history and normality of user behavior, and from other sources like AI/ML engine, user browser fingerprint, geolocation, and so on. You can use this API for continuous authentication, enabling the Workforce Authority risk engine to calculate the LOA score based on changes to the current session and context to the existing request.

For example, during a user session, a change in the IP address, browser fingerprint, or GPS location can impact the LOA score in a current session. You can also use the API to send data to the risk engine from native or web applications that do not have a direct integration with the Workforce Authority Mobile SDK or a single sign-on solution.

Callers of the legacy POST /api/v10/risk_engine/calculate_score should move to /api/integration/v2/risk_engine/calculate_score.

Note

For the OAuth calculate LOA score API to work, the application must have permission to send data to the risk_engine.

Request

Method URL
POST /api/integration/v2/risk_engine/calculate_score

Parameters

Field Type Description
username String The user's unique identifier within the organization. Required unless email is given. A user not yet in the organization is created.
email String Deprecated alias for username. Required unless username is given.
session_uid optional String A unique identifier for the session. This is the unique value that the relying party should generate for the lifetime of a session and should be unique across the relying party organization between different applications. A session_uid already used for another user returns 500 and server_error.
event String The authentication event; possible values are pre-auth, auth, post-auth, and cont-auth (continuous authentication).
context JSON The context of the authentication request should contain all the key/values the relying party has from the user’s request. Depending on the keys present in this parameter, the Workforce Authority risk engine decides which risk analyzers it must engage in calculating the final LOA score. For the list of possible key-value pairs, see the Context section.
Note

To have the risk engine remember the IP address and DBFP as known for this user in future requests, send post-auth as the event, unless oob_name is policy. Other events do not record them. Location is not remembered.

Context

The Workforce Authority risk analyzers read the keys below. Conditional policies and the risk log also read other keys, such as country and secure_action; a security-escalation policy can match secure_action (reset_password) and change the LOA score. Keys the risk analyzers do not recognise do not affect their scores, though a Code policy condition receives the whole context. The risk log stores only the keys the engine recognises.

Key Description Risk Analyzer
ip_address The public IP address of the end user. The IP address in the DBFP token, then remote_ip_address, take precedence over it. Send it: without it, the caller's own IP fills ip_address, and remote_ip_address too when that is absent. IP
remote_ip_address The end user’s IP address behind a proxy. Takes precedence over ip_address. An IP address in the DBFP data wins over both: the one inside a bfpToken, or, with raw fingerprint data, ip_address itself. IP
latitude The GeolocationCoordinates.latitude property is a double-precision floating point value which represents the latitude of a geographical position, specified in decimal degrees. GPS
longitude The GeolocationCoordinates.longitude property is a double-precision floating point value which represents the longitude of a geographical position, specified in decimal degrees. GPS
accuracy The GeolocationCoordinates.accuracy attribute denotes the accuracy level of the latitude and longitude coordinates in meters (such as 65 meters). Workforce Authority will discard the geolocation information if accuracy is above a certain threshold. By default this number is 100 and it will discard any data with accuracy above 100. GPS scores the distance to the location the user's mobile device reported in the last 15 minutes by default. It runs only when accuracy is present and within the limit, and the device has reported a location in that window. Send latitude and longitude with it; without them, the IP address's geolocation is used, unless GeoIP lookup is disabled for the deployment or the user, or the address is private. GPS
bfpToken When integrating with the Workforce Authority DBFP JavaScript plugin, the device and browser fingerprints (DBFP) engine will create a cookie named jwt. The value of this cookie should be passed as bfpToken to the risk engine. DBFP
jwt Alias of bfpToken, read when bfpToken is absent. DBFP
fingerprint Raw DBFP data, read when neither bfpToken nor jwt is sent. With fingerprint present, the fingerprint fields such as hash1–hash4 are read from the context itself. DBFP
oob_name Out-of-band method used during authentication. Scored values are: push, symbol_push, totp, sms, email, voice, qrcode, fido_u2f, password, static_pin. policy is accepted but adds no score. Scored on post-auth and cont-auth only. auth_method is a deprecated alias. Authentication Method

Sample web request

{
  "session_uid":"xxxxx1f1f5a634355702ced92951xxxx",
  "username":"jian-yang@piedpiper.com",
  "event": "post-auth",
  "context": {
    "ip_address": "76.115.75.122",
    "bfpToken": "eyJhbGciOiJIUzI1NiJ9.eyJmaW5nZXJwcmludCI6ImY4MzQ2ODY3MTVjNWFlZmQwMTA5ZTMzN2UyZjlmZTE0IiwiaGFzaDEiOiI2YTUwNTdkMDcyN2JhOWU5NmM5YzY0YWQxNzQ1MThmNSIsImhhc2gyIjoiNzVkOTE0OWQ4YmIyMzE2YjM0ZGMxYmY2NDJjN2NlODQiLCJoYXNoMyI6Ijk1YTRlYmEwMmY4OTg2YmE3ZTc0Y2NhNTQ1MDIxOWMxIiwiaGFzaDQiOiI0OGJjZDIyY2Q0NDE0MDhiYTQzOGE2NDkyOTE4NWI3NSIsImJyb3dzZXJfb3V0ZGF0ZWQiOmZhbHNlfQ.H774bfHd8wbduYlaQLva6YNJnMvw-fgctuYfTNblKfY",
    "latitude": 37.4419,
    "longitude": -122.1430,
    "accuracy": 20,
    "oob_name": "totp"
  }
}

Response

Successful response

Field Type Description
response_code String success
content.success Boolean true
content.loa_score Float LOA score calculated by the risk engine based on the parameters provided in the request context.
content.message String Blank for successful requests.
content.id String Internal risk session ID.
content.request_id Integer Number of the request within the risk session.
content.session_uid String The session identifier: the one you sent, or a generated one.
content.event String The authentication event from the request.
content.risk_analyzers Array Risk analyzer result objects describing the reason behind the LOA score

Successful response example

HTTP/1.1 200 OK

{
  "response_code": "success",
  "content": {
    "id": "8c2f6a1e-3b4d-4f5a-9e8d-7c6b5a4f3e2d",
    "message": "",
    "success": true,
    "loa_score": 2.75,
    "request_id": 1,
    "session_uid": "xxxxx1f1f5a634355702ced92951xxxx",
    "event": "post-auth",
    "risk_analyzers": [
      {
        "id": 1,
        "data": {
          "hash1": "6a5057d0727ba9e96c9c64ad174518f5",
          "hash2": "75d9149d8bb2316b34dc1bf642c7ce84",
          "hash3": "95a4eba02f8986ba7e74cca5450219c1",
          "hash4": "48bcd22cd441408ba438a64929185b75",
          "fingerprint": "f834686715c5aefd0109e337e2f9fe14"
        },
        "name": "DBFP",
        "reasons": {
          "hash2": 1,
          "hash4": 0.25,
          "matched_via": "hash4,hash2",
          "matched_dbfp_id": "5d0f3c2a-8b1e-4c6d-9a7f-2e4b6c8d0a1f"
        },
        "loa_delta": 1.25,
        "risk_score": null,
        "applied_weight": 1.0,
        "weight": 1.0,
        "class_name": "RiskDbfpAnalyzer",
        "updated_at": "2021-02-13T01:52:12.607Z",
        "description": "Provides LOA Score Analysis based on Browser fingerprints"
      },
      {
        "id": 4,
        "data": {
          "mobile_vs_auth_request_distance_in_meters": 6.16
        },
        "name": "GPS",
        "reasons": {
          "mobile_browser_proximity": "6.16 meters"
        },
        "loa_delta": 4,
        "risk_score": null,
        "applied_weight": 0.5,
        "weight": 0.5,
        "class_name": "RiskLocationAnalyzer",
        "updated_at": "2021-02-13T01:52:12.616Z",
        "description": "Provides LOA Score Analysis based on the GPS coordinates of requests"
      },
      {
        "id": 2,
        "data": {
          "ip_address": "76.115.75.122"
        },
        "name": "IP",
        "reasons": {
          "known_exclusive_user_ip_address": 4
        },
        "loa_delta": 4,
        "risk_score": null,
        "applied_weight": 0.5,
        "weight": 0.5,
        "class_name": "RiskIpAnalyzer",
        "updated_at": "2021-02-13T01:52:12.631Z",
        "description": "Provides LOA Score Analysis based on the IP address of requests"
      },
      {
        "id": 3,
        "data": {
          "auth_method": "totp"
        },
        "name": "Authentication Method",
        "reasons": {
          "totp": 3
        },
        "loa_delta": 3,
        "risk_score": null,
        "applied_weight": 1.0,
        "weight": 1.0,
        "class_name": "RiskAuthMethodAnalyzer",
        "updated_at": "2021-02-13T01:52:12.640Z",
        "description": "Provides LOA Score Analysis based on the Authentication and out of band method user used to sign in."
      }
    ]
  }
}

Unsuccessful response

Field Type Description
response_code String invalid, invalid_parameter, not_found or server_error.
message String Informative message describing the error.
content.loa_score Integer 0 for unsuccessful requests. Absent on invalid_parameter and not_found.
Response codes
Response code Description
invalid 401 when the application may not use the risk engine; 422 when the user cannot be created.
invalid_parameter 400; a parameter is missing or invalid.
not_found 404; the tenant is disabled and the token names no tenant in its audience (legacy /oauth/token).
server_error 500; an unexpected failure.

Unsuccessful response examples

HTTP/1.1 401

{
  "response_code": "invalid",
  "message": "Risk Engine APIs are not enabled for this application. For more information, contact support@example.com.",
  "content": {
    "loa_score": 0
  }
}
HTTP/1.1 422

{
  "response_code": "invalid",
  "message": "Unable to create the user with Joe Smith <joe@example.com>: Username is invalid",
  "content": {
    "loa_score": 0
  }
}
HTTP/1.1 400

{
  "response_code": "invalid_parameter",
  "message": "Parameter event invalid: Parameter event is required"
}
HTTP/1.1 500

{
  "response_code": "server_error",
  "message": "Something went wrong. For help, contact support@example.com.",
  "content": {
    "loa_score": 0
  }
}

Notification

After initiating an authentication request, the relying party has the option of getting notified as soon as the MFA phase is complete. The notification is sent when the request is approved or rejected. Expiry sends no notification, so call Status when expires_at passes.

To listen for the notification, the relying party should use the channel returned by the initial user authentication request to subscribe to the Workforce Authority Faye server. Use the following JavaScript snippet (written using jQuery but vanilla JavaScript works as well).

<script src="https://faye.acceptto.com/faye/faye.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<script type="text/JavaScript">
  $(function() {
      var faye = new Faye.Client("https://faye.acceptto.com/faye");
      faye.subscribe("/messages/<%= @channel %>", function (data) {
          window.location.reload(); // refresh the page and call check api on refresh
      });
  });
</script>

As soon as the MFA phase is complete, a notification is sent to Faye which relays it to any relying party subscribed to the channel and the code block inside faye.subscribe executes. Make sure that you are replacing the <%= @channel %> with the channel returned by the user authentication call and customize the code block inside faye.subscribe; the method above simply refreshes the page but generally a redirection to a results page is used.

MFA integration with device browser fingerprint

Use the following steps to integrate MFA with DBFP.

  1. In your HTML page, load the DBFP script, then start it once the page has loaded:

    <!-- Workforce Authority DBFP -->
    <script src="https://dbfp.acceptto.com/bfp.js" defer></script>
    <script>
      window.addEventListener("load", function () {
        SecureAuth.getFingerprint({
          jwtEnabled: true,
          enableGps: true,
          mode: "default"
        });
      });
    </script>
    <!-- End Workforce Authority DBFP -->
    

    With jwtEnabled set, the script stores its result in a cookie named jwt. Pass that cookie's value to the user authentication APIs as bfpToken. Workforce Authority uses it to assess the risk of the request: the browser fingerprint, the user's IP address and the browser's GPS location. The server compares this data with the user's history to detect anomalies.

    enableGps asks the browser for its location, which prompts the user. Set it to false to skip GPS.

  2. Save your changes.