Learn how to use the Hanko Backend with your mobile apps.
Check if the user exists
200
or 404
. If you get 200
, remember the id
returned in the response object and go to step ‘Send a passcode’.
If you get 404
, go to the next step.Create user
200
or 409
. If you get 409
, then the user already exists, and you can obtain the users id
from the success response of the endpoint mentioned in the previous step.
If you get 200
, remember the id
returned in the response object.Send a passcode
id
you obtained in one of the previous steps. If sending the passcode was successful, you will get an id
for the passcode in the response object. Remember this id
, because you will need it to finalize the passcode flow.When the user entered the passcode, send it together with the passcode id
from the Init endpoint to the Finalize passcode login endpoint.
When the passcode is correct you will get a JWT either as a cookie or in the X-Auth-Token
header (depends on the configuration of the Hanko backend) .The user is now logged in. To verify (in your backend) that the JWT is valid, see our Backend guide.Optionally you can offer the user to register a passkey now, enabling a faster login flow the next time. See the next step on how to do it.Create a passkey (optional)
PublicKeyCredentialAttestationOptions
which you can get from the Initialize WebAuthn registration endpoint.After the native system APIs were called with the options you will receive a PublicKeyCredentialAttestationResponse
. Send the response to the Finalize WebAuthn registration endpoint.
If successful, the user can use the created passkey to login faster the next time.webauthn.relying_party.origins
or in the advanced page in the settings at Hanko Cloud.
Use this command to create the “APK Key Hash”:-alias
and -keystore
flag values to your personal values.Login with a passkey (optional)
PublicKeyCredentialAssertionOptions
which you can get from the Initialize WebAuthn login endpoint.After the native system APIs were called with the options you will receive a PublicKeyCredentialAssertionResponse
. Send the response to the Finalize WebAuthn login endpoint.
If successful you will get back a JWT either as a cookie or in the X-Auth-Token
header (depends on the configuration of the Hanko backend).The user is now logged in. To verify (in your backend) that the JWT is valid, see our Backend guide.