Smart-ID authentication process in Dokobit Identity 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)
You can check more documentation at https://developers.dokobit.com/api/doc.
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.
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=30303039914&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 120 seconds.
REQUEST URL: https://developers.dokobit.com/smartid/login/status/AUTHENTICATION_TOKEN.json?access_token=YOUR_ACCESS_TOKEN METHOD: GET RESPONSE { "status": "ok", "name": "QUALIFIED OK1", "surname": "TESTNUMBER", "code": "30303039914", "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, you can test authentication scenarios with the data
here.