CustomerEmployee) are members of one organization who use the dashboard or the API. Tenant users (TenantUser) are your team members who work across the organizations of a tenant, and log in like org users. End users (EndUser) are your own customers, who own delegated wallets in your application. Each login flow is for some of them.
Regular login flow
User login is a two step process.1
Create a user login challenge
Use : Create Login Challenge.This will generate a challenge to be signed by the user.If the user has a credential of kind
PasswordProtectedKey a temporary one time code needs to be passed in the loginCode field.
Send this code first by using : Send Login Code.
That’s required because the Create Login Challenge endpoint is unauthenticated and returns the encrypted private key of the user. So we need a first step to verify the identity of the user to prevent anybody from fetching the encrypted private key and trying to brute force it offline.If the user has at least one discoverable webauthn credential, username is optional (usernamless flow).2
Get the user to sign the challenge
Depending on the type of credentials being used, the challenge can be signed in different ways:
- passkey: the browser or the OS will handle the signing operation using WebAuthn APIs by creating a new passkey on the user device.
- personal access token: the private key associated with the token can be used to sign the challenge.
- service account token: the private key associated with the service account can be used to sign the challenge.
- password-protected key: the Create Login Challenge response returns the credential’s
encryptedPrivateKeyinallowCredentials.passwordProtectedKey. Decrypt it on the frontend using the user’s password, then sign the challenge with the decrypted private key. DFNS never receives the password or the decrypted key. See Implement password-protected keys for a full walkthrough with code.
3
Complete the user login
Use : Complete User Login.Completes the login process and provides the authenticated user with their authentication token.The type of credentials used to login is determined by the kind field in the nested objects (
firstFactor and secondFactor). Supported credential kinds are:Fido2: Login challenge is signed by a user’s signing device using WebAuthn.Key: Login challenge is signed by a user’s private key.PasswordProtectedKey: Login challenge is signed by the decrypted user’s private key that was sent during Create User Login Challenge step.
SSO login flow
SSO is for org users and tenant users only. The user must already be invited, with SSO required for their account (isSSORequired).
On request, DFNS can let your identity provider manage these users too: users are created on their first sign-in, and their roles and group memberships follow your identity provider’s role claims at each login. This setup uses Initiate OIDC Login and Complete OIDC Login instead of the SSO endpoints.
1
Obtain the SSO URL
Use : Initiate SSO Login.This generates a URL from your SSO provider.
Send the user to that URL to log in.The redirect URL will contain a
Important note:Once authenticated, the user will be redirected to the
redirect URL you have set up on your SSO provider’s dashboard. Make sure this URL is also whitelisted for your settings. See the SSO set up tutorial for more details.code and a state. Use those in the next step!2
Log the user in
Use : Complete SSO Login, providing the
code and state obtained in the previous step.This will log the user in and respond with the authentication token.Social login flow
Use to obtain an authentication token for an end user who registered through social registration. Social login accepts Google ID tokens only. Tokens from any other identity provider are rejected. To log end users in with your own identity provider (Auth0, Clerk, Okta, …), authenticate them in your application and use delegated login. DFNS matches a returning user by theemail claim of the Google ID token, which is their DFNS username, and checks that the sub claim matches the Google account used at registration. A new ID token for the same Google account logs in the same DFNS user.
See Social Login for more details.
Delegated login flow
A service account should use to obtain an authentication token for the end user. DFNS does not take part in the end user’s authentication: you are responsible for logging them in properly in your application. The service account needs theAuth:Delegated:Login permission, and the request requires a user action signature from the service account (X-DFNS-USERACTION header). The DFNS SDKs sign it for you when the client is configured with the service account’s signer.
See Delegated Login for more details.
Delegated login is for end users (
EndUser) only. An org user registered through delegated registration logs in with their own credentials, through the regular login flow.