#
Sign-in with IdenaThe sign-in with Idena function can be used on your website to determine the Idena user's address and its status. You can grant a user a certain privileges depending on their Idena status:
Undefined
- not validated userCandidate
- candidate for the upcoming validation ceremonyNewbie
- user validated 1 or 2 timesVerified
- user validated at least 3 timesHuman
- user validated more than 3 timesSuspended
- validated user missed the last validationZombie
- validated user missed the two last validations
Sign-in with Idena protocol provides you a proof that user possesses a private key of their Idena address.
Your auth server should generate a random nonce
which Idena app signs with users private key. Your auth server should follow the Sign-in with Idena protocol and check nonce
the signature. You can find Auth server exmple here.
#
Sign-in with Idena app URLYou can authorise users either with Idena Web App or Idena Desktop App:
#
1. Sign-in URL for Idena Web App (recommended)It's recommended to use Idena Web App as a default method for users authorization. Users who have no Idena account in the browser can use the Idena Desktop App by clicking Open in Idena app
link below:
URL example for signing in with Idena Web App:
#
2. Sign-in URL for Idena Desktop AppThe Idena Desktop App pops up automatically when the user clicks dna://signin/...
URL (see more about Idena app URL scheme).
URL example for signing in with Idena Desktop App:
#
Sign-in with Idena protocol- The following dialog appears automatically in Idena App:
- When the user clicks the
Confirm
button specific endpoints will be called on your auth server:
nonce_endpoint
is called to fetch the randomnonce
generated by your auth server- Then Idena app signs the
nonce
automatically authentication_endpoint
is called by Idena app to provide the nonce signature for your auth server
- At the end the
callback_url
will be opened in the user's browser
As a result your user's Idena address will be known to your server. You can check the validation state
of the user's address using the API or the Idena node RPC to grant privileges to the user on your website.
signin
app URL example#
URL example for signing in with the Idena public address:
token
: GUID string (can be generated in the client's browser).nonce_endpoint
: specifies url for the POST method to get a random nonce from the website server.
Successful response with a random nonce has to be provided. Nonce must have signin-
prefix.
See example POST /start-session
method below.
authentication_endpoint
: specifies url for the POST method for the authentication.
Successful response with authenticated
flag has to be provided.
See example POST /authenticate
method below.
callback_url
: specifies url that will be opened in the client's browser automatically after successful authentication.favicon_url
: specifies custom url for the icon displayed for user in the Idena app (optional parameter).
POST /start-session
method#
Request body example:
Successful response example:
Nonce provided in the response data must have signin-
prefix.
Fail response example:
POST /authenticate
method#
Request body example:
Successful response must be returned if user's address is equal to address derived from the signature (e.g. function signatureAddress to get address from the nonce signature). Ethereum utils can be used for signature verification as following:
Successful response example:
Failed authentication response example:
Fail response example:
#
Additional methodsThese methods are not used for the Idena authentication protocol.
GET /get-account
method#
Request example:
Successful response example:
Fail response example:
POST /logout
method#
Request body example:
Successful response example:
Failed log out response example:
Fail response example: