OK we get it. “Dependencies are evil”, you’re a badass.
If you wish to implement our IDaaS by yourself, it’s still pretty easy. When a user begins authentication:
- Redirect the user to eID Easy authorize endpoint.
URL:https://id.eideasy.com/oauth/authorize
Required query parameters:client_id
– client_id value that you got when registering the websiteredirect_uri
– you set this value when you registered your website in My Webpagesresponse_type
– this is always “code
”. Don’t ask why.
Optional query parameters:lang
– language of the user. Use 2-letter codes: (ISO 639-1)start
– user’s selected method code. If specified, authentication will begin with this method, user will not be asked to select authentication method. See available method codes.method
– (deprecated) same as start, but in case of ID cards, authentication will not begin until user clicks relevant button.user’s selected method code.phone
– Mobile-ID mobile number prefillidcode
– Smart-ID and Mobile-ID number prefillcountry
– Smart-ID country preselect EE, LT or LV
Example:https://id.eideasy.com/oauth/authorize?client_id=pM...m5&redirect_uri=https://your-site.com/login&response_type=code
- User will identify him/her/it on our login page. Don’t worry, we’ll send them back.
- After authentication, user is redirected to your
redirect_uri
. e.ghttps://your-site.com/login?code=j93jd0qk
. Notice you received a query param namedcode
. We’ll use this in the next step. - Make a POST request eID Easy server to ask for access token.
URL:https://id.eideasy.com/oauth/access_token
Required body parameters:client_id
– client_id value that you got when registering the websiteclient_secret
– secret value that you got when registering the websiteredirect_uri
– redirect_uri value that you entered when registering the websitecode
– code value that was set when redirecting user back from authorization endpointgrant_type
– this is always “authorization_code
”.
Example body:code=fy...36&grant_type=authorization_code&client_id=r1...oo&client_secret=Iu...ch&redirect_uri=http%3A%2F%2Fexample.com%2Flogin
.
Make sure that headers contain “Content-Type: application/x-www-form-urlencoded” andredirect_uri
value is urlencoded.
Example response:{"access_token":"yF...zc","token_type":"Bearer","expires_in":3600}
.
You’ll need theaccess_token
value in the next step. - Make a GET request to eID server to ask for user details.
URL:https://id.eideasy.com/api/v2/user_data
Required query parameters:access_token
– you got this from the previous step.
Example:https://id.eideasy.com/api/v2/user_data?access_token=2D...Co
Example response:
{
"status": "OK",
"idcode": "38112086027",
"lastname": "Pala",
"firstname": "Margus",
"current_login_method": "ee-id-login",
"birth_date": "1981-12-08",
"country": "EE",
"current_login_info": {
"valid_from": "2017-11-08T07:49:13+00:00",
"valid_to": "2022-10-12T20:59:59+00:00"
}
}
Job well done!