const eidEasyClient = window.eidEasyBrowserClient.createClient({clientId:'2IaeiZXbcKzlP1KvjZH9ghty2IJKM8Lg',// requiredredirectUri:'http://localhost/',// requiredapiEndpoints:{// requiredidentityStart:()=>'https://eid-sample-app.test/api/identity/start',identityFinish:()=>'https://eid-sample-app.test/api/identity/finish',},countryCode:'EE',// requiredlanguage:'et',sandbox:true,oauthParamState:'custom-state-value',// this gets used only in case of identification methods});
Required. Get from id.eideasy.com after signing up.
redirectUri
string
undefined
Required. This gets used for redirects back to your application e.g. when using eParaksts mobile. The value of redirectUri has to match with the "Oauth redirect_uri(s)" setting you provided in your eID Easy admin page.
apiEndpoints.identityStart
function
undefined
Required. This should return your server endpoint for the identity start request.
apiEndpoints.identityFinish
function
undefined
Required. This should return your server endpoint for the identity finish request.
eidEasyClient.identification.idCard.start({fail:(error)=>{// do something with the error},success:(result)=>{// do something with the result},finished:()=>{// the process has finished, you can do some clean up like hiding a loader here},});
This function gets called when the authentication process failed.
success
function
undefined
This function gets called when the authentication process succeeds.
finished
function
undefined
This function gets called when the authentication process has either failed or succeeded. This means that this function gets called always, no matter the authentication result. For example, it can be useful to hide a loading spinner at the end of the authentication process or to do some other clean up work.
eidEasyClient.identification.smartId.start({idcode:'10101010005',// requiredstarted:(result)=>{// do something with the result// e.g. display the result.data.challenge code},fail:(error)=>{// do something with the error},success:(result)=>{// do something with the result},finished:()=>{// the process has finished, you can do some clean up like hiding a loader here},});
This function gets called when the authentication process has started. The argument object of this function contains the challenge (response.data.challenge) you can display to the end-user.
fail
function
undefined
This function gets called when the authentication process failed.
success
function
undefined
This function gets called when the authentication process succeeds.
finished
function
undefined
This function gets called when the authentication process has either failed or succeeded. This means that this function gets called always, no matter the authentication result. For example, it can be useful to hide a loading spinner at the end of the authentication process or to do some other clean up work.
eidEasyClient.identification.mobileId.start({idcode:'60001019906',// requiredphone:'+37200000766',// requiredstarted:(result)=>{// do something with the result// e.g. display the result.data.challenge code},fail:(error)=>{// do something with the error},success:(result)=>{// do something with the result},finished:()=>{// the process has finished, you can do some clean up like hiding a loader here},});
Required. End user's phone number, must have the country codeopen in new window prefixed with a '+' sign, e.g. +37200000766
started
function
undefined
This function gets called when the authentication process has started. The argument object of this function contains the challenge (response.data.challenge) you can display to the end-user.
fail
function
undefined
This function gets called when the authentication process failed.
success
function
undefined
This function gets called when the authentication process succeeds.
finished
function
undefined
This function gets called when the authentication process has either failed or succeeded. This means that this function gets called always, no matter the authentication result. For example, it can be useful to hide a loading spinner at the end of the authentication process or to do some other clean up work.
user gets redirected to the eParaksts page where they have to enter their user number
eParaksts then asks the user for confirmation on their cellphone
user gets redirected back to the redirectUri specified in the eidEasyClient settings with a token you can use to fetch data
eidEasyClient.identification.eParakstsMobile.start({redirect:(context)=>{
console.log(context);// you can do the redirect here yourself should you wish so// window.location.href = context.redirectUrl;return{data:null,};},});
eidEasyClient.identification.frejaEid.start({idcode:'xxxxxxxxxxxxx',// requiredstarted:()=>{// identification process has started,// Freja eID app will prompt the user to approve the identification request},fail:(error)=>{// do something with the error},success:(result)=>{// do something with the result},finished:()=>{// the process has finished, you can do some clean up like hiding a loader here},});
This function gets called when the authentication process has started, Freja eID app will prompt the user to approve the identification request.
fail
function
undefined
This function gets called when the authentication process failed.
success
function
undefined
This function gets called when the authentication process succeeds.
finished
function
undefined
This function gets called when the authentication process has either failed or succeeded. This means that this function gets called always, no matter the authentication result. For example, it can be useful to hide a loading spinner at the end of the authentication process or to do some other clean up work.
When the ZealiD identification process starts, eidEasyClient will automatically create a ZealId iframe and start listening for messages originating from that iframe. You just have to provide a DOM element (the "iframeHolder" setting in the example below) to which eidEasyClient can append the iframe.
eidEasyClient.identification.zealId.start({iframeHolder: document.getElementById('zealIdIframeHolder'),// Required. DOM element whose content gets replaced with the ZealiD's iframefail:(error)=>{// do something with the error},success:(result)=>{// do something with the result},finished:()=>{// the process has finished, you can do some clean up like hiding a loader here},});
Required. DOM element whose content gets replaced with the ZealiD's iframe
fail
function
undefined
This function gets called when the authentication process failed.
success
function
undefined
This function gets called when the authentication process succeeds.
finished
function
undefined
This function gets called when the authentication process has either failed or succeeded. This means that this function gets called always, no matter the authentication result. For example, it can be useful to hide a loading spinner at the end of the authentication process or to do some other clean up work.
Austrian Handy Signatur is a redirect based method, so:
user gets redirected to the Austrian Handy Signatur page where they have to enter their user and mobile number
Austrian Handy Signatur then asks the user for confirmation on their cellphone
user gets redirected back to the redirectUri specified in the eidEasyClient settings with a token you can use to fetch data
eidEasyClient.identification.atHandy.start({redirect:(context)=>{
console.log(context);// you can do the redirect here yourself should you wish so// window.location.href = context.redirectUrl;return{data:null,};},});
Required. Get from id.eideasy.com after signing up.
docId
string
undefined
Required. The docId of the document you have prepared for signing. You can find more information on file preparation hereopen in new window and the API reference for file preparation hereopen in new window
eidEasyClient.signature.idCardSignature.start({countryCode:'EE',iframeHolder: document.getElementById('idCardIframeHolder'),// Required. DOM element whose content gets replaced with an iframe (this iframe will be used to get the signing certificates from the id card)fail:(error)=>{// do something with the error},success:(result)=>{// do something with the result},finished:()=>{// the process has finished, you can do some clean up like hiding a loader here},});
Required. DOM element whose content gets replaced with an iframe (this iframe will be used to get the signing certificates from the id card)
fail
function
undefined
This function gets called when the signing process failed.
success
function
undefined
This function gets called when the signing process succeeds.
finished
function
undefined
This function gets called when the signing process has either failed or succeeded. This means that this function gets called always, no matter the authentication result. For example, it can be useful to hide a loading spinner at the end of the authentication process or to do some other clean up work.
eidEasyClient.signature.smartIdSignature.start({idcode:'10101010005',// requiredccountryCode:'EE',// requiredstarted:(result)=>{// do something with the result// e.g. display the result.data.challenge code},fail:(error)=>{// do something with the error},success:(result)=>{// do something with the result},finished:()=>{// the process has finished, you can do some clean up like hiding a loader here},});
This function gets called when the signing process has started. The argument object of this function contains the security challenge code (response.data.challenge) that the end user sees on their device. You should display this code in your app so that the user can be sure that they are signing the right document.
fail
function
undefined
This function gets called when the signing process failed.
success
function
undefined
This function gets called when the signing process succeeds.
finished
function
undefined
This function gets called when the signing process has either failed or succeeded. This means that this function gets called always, no matter the authentication result. For example, it can be useful to hide a loading spinner at the end of the authentication process or to do some other clean up work.
eidEasyClient.signature.mobileIdSignature.start({idcode:'60001019906',// requiredphone:'+37200000766',// requiredccountryCode:'EE',// requiredstarted:(result)=>{// do something with the result// e.g. display the result.data.challenge code},fail:(error)=>{// do something with the error},success:(result)=>{// do something with the result},finished:()=>{// the process has finished, you can do some clean up like hiding a loader here},});
This function gets called when the signing process has started. The argument object of this function contains the security challenge code (response.data.challenge) that the end user sees on their device. You should display this code in your app so that the user can be sure that they are signing the right document.
fail
function
undefined
This function gets called when the signing process failed.
success
function
undefined
This function gets called when the signing process succeeds.
finished
function
undefined
This function gets called when the signing process has either failed or succeeded. This means that this function gets called always, no matter the authentication result. For example, it can be useful to hide a loading spinner at the end of the authentication process or to do some other clean up work.
eParaksts Mobile is an OAuth2 based method, so the user gets redirected to the eParaksts page where they can complete the signing process.
eidEasyClient.signature.eParakstsMobileSignature.start({redirect:(context)=>{
console.log(context);// you can do the redirect here yourself should you wish so// window.location.href = context.redirectUrl;return{data:null,};},});
ZealId signing is a redirect based method, so the user gets redirected to the Zeal ID view where they can use their smartphone to complete the signing process.
eidEasyClient.signature.zealIdSignature.start({ccountryCode:'EE',// requiredredirect:(context)=>{
console.log(context);// you can do the redirect here yourself should you wish so// window.location.href = context.redirectUrl;return{data:null,};},});
Austrian Handy Signatur is a redirect based method, so the user gets redirected to the Austrian Handy Signatur page where they will complete the signing process.
eidEasyClient.signature.atHandySignature.start({redirect:(context)=>{
console.log(context);// you can do the redirect here yourself should you wish so// window.location.href = context.redirectUrl;return{data:null,};},});
This is done through a redirect, so the user gets redirected to a view where they will see all the buttons for all the available Finnish Banks and the Mobile ID button. They then choose their preferred method and complete the signing process.
eidEasyClient.signature.ftnSignature.start({redirect:(context)=>{
console.log(context);// you can do the redirect here yourself should you wish so// window.location.href = context.redirectUrl;return{data:null,};},});
With OTP, eID Easy will send the user either an email or sms (depending on with which parameters you initiate the flow) that contains a one time password. You then ask the user to enter that OTP in your application and then provide it to the otpSignature module.
eidEasyClient.signature.otpSignature.start({smsToken:'123455',emailToken:'873nf7ssorwdm8e',fail:(error)=>{// do something with the error},success:(result)=>{// do something with the result},finished:()=>{// the process has finished, you can do some clean up like hiding a loader here},});
This function gets called when the signing process failed.
success
function
undefined
This function gets called when the signing process succeeds.
finished
function
undefined
This function gets called when the signing process has either failed or succeeded. This means that this function gets called always, no matter the authentication result. For example, it can be useful to hide a loading spinner at the end of the authentication process or to do some other clean up work.