Smart-ID authentication process in Dokobit Documents API

Please be aware that access_token parameter must be sent with every request.

Successful authentication process requires to use only two endpoints:
1. /smartid/login.json (for initializating authentication process)
2. /smartid/login/status/{token}.json (for checking authentication status)

1.  /smartid/login.json

First of all you have to make POST request to "/smartid/login.json" with two required params - personal code and country code.
 REQUEST
 URL: https://developers.dokobit.com/smartid/login.json?access_token=YOUR_ACCESS_TOKEN
 METHOD: POST
 BODY: code=10101010005&country=LT

 RESPONSE
 {
     "status": "ok",
     "token": "AUTHENTICATION_TOKEN",
     "control_code": "3031"
 }
After receiving this response, make sure to display "control_code" for the user because they need to verify that this control code is the same as they see one in their Smart-ID application.

2.  /smartid/login/status/{token}.json
Now you need to start checking status of authentication process by making GET request to "/smartid/login/status/{token}.json". You should do it every 3 seconds until other than {"status":"waiting"} response is returned and not longer than 100 seconds.
 REQUEST
 URL: https://developers.dokobit.com/smartid/login/status/AUTHENTICATION_TOKEN.json?access_token=YOUR_ACCESS_TOKEN
 METHOD: GET

 RESPONSE 
 {
     "status": "ok",
     "name": "DEMO",
     "surname": "SMART-ID",
     "code": "10101010005",
     "country": "LT",
     "certificate": {...}
 }
 or
 {
     "status": "waiting"
 }
 or
 {
     "status": "canceled"
 }
 or
 {
     "status": "error",
     "message": "Expired transaction",
     "error_code": 6005
 }
When you receive successful response with status "ok", authentication process is finished and you can authorize user by using their personal code and country received in this request.
If in any step you received response with status different than "waiting", you need to stop requesting status of that session and inform user with error message. 
If you need to translate errors to other languages, please use error_code value from response (error codes with their meanings can be found here https://developers.dokobit.com/errors)

After successful integration please test authentication scenarios by using this data:
10101010005 LT - Successful authentication
10101010016 LT - User refused to authenticate
10101010027 EE - Timeout

Still need help? Contact us Contact us