Best Practices
Most integration problems we see in support come from the same few causes. Follow these six rules and your integration will work across all methods, devices, and environments.
| # | Do | Don't |
|---|---|---|
| 1 | Redirect the user to the flow as a full page | Load eID or signing flows in an iframe |
| 2 | Open flows in the device's default browser | Start flows in an in-app browser or WebView |
| 3 | Wait for the document signed webhook | Poll the download endpoint |
| 4 | Call the API from your server | Send requests with your secret or HMAC key from the front end |
| 5 | Use test user accounts in the test environment | Try real eIDs in the test environment |
| 6 | Treat test signatures as samples | Expect test signatures to be legally valid or to pass validators |
1. Don't use iframes
eID and signing flows can't be displayed inside an iframe on any device. Browsers restrict cookies, redirects, and app launches inside iframes, and some eID and signature providers block iframes altogether.
Do this instead: redirect the user to the eID Easy authentication or signing page as a full page, and let them return to your redirect_uri or signature_redirect when they finish.
The only exception is Embedded ID card signatures, a component built specifically to run in an iframe.
More details: Mobile devices and iframes.
2. Don't start flows in an in-app browser
On mobile devices, open eID and signing flows in the device's default standalone browser. In-app browsers aren't supported. This covers WebViews in your own native app and the browsers built into apps such as Slack, Facebook, Instagram, or LinkedIn, which open when a user taps a link inside them.
Many methods hand the user over to a provider's mobile app and then back to the browser. In-app browsers often can't open the provider's app, lose cookies along the way, or can't bring the user back to the page that started the flow.
Do this instead:
- Open the authentication or signing URL in the device's default browser.
- Let the user complete the flow there.
- Handle the result through your registered
redirect_uri. If the user needs to end up back in your native app, make theredirect_uria link that opens your app, for example a Universal Link on iOS or an App Link on Android.
Android Custom Tabs work with some providers but must be validated case by case. See Mobile devices and iframes.
3. Don't poll the download endpoint
Don't call /api/signatures/download-signed-file in a loop to find out whether a document has been signed. The file isn't available until signing has finished, and a user can take minutes or days to sign.
Do this instead:
- Configure the Document signed webhook for your webpage in the admin panel.
- Verify each webhook request before you trust it.
- When the webhook arrives, download the signed file once, using the
doc_idfrom the webhook body.
Use the user's return to your signature_redirect only to show them the result. Users can close the browser before they're redirected, so don't rely on the redirect to learn that a document was signed.
If your endpoint responds with a 4xx or 5xx status code, eID Easy retries the webhook after 5 minutes and again after 60 minutes.
4. Don't make requests with your secret or HMAC key from the front end
Anything in front-end code can be read by your users. That includes browser JavaScript and the code shipped inside mobile apps. Anyone who has your secret or e-seal HMAC key can use eID Easy services at your expense.
Do this instead:
- Make every request that includes your
secretfrom your server. The same goes for requests signed with your e-seal HMAC key. - Let your front end call your own backend, and pass on only what the browser needs, such as a
doc_idor the signing page URL. - Load the credentials from environment variables or a secrets manager, not from code. Don't commit them to a git repository.
Your client_id isn't secret and can be used in the front end.
If a secret or HMAC key has been exposed, contact support to have it replaced.
More details: API Credentials.
5. Use test user accounts in the test environment
Real eIDs don't work in the test environment. A real Smart-ID account, ID card, or bank login will fail there, and this doesn't mean your integration is broken. In the same way, test user accounts don't work in the live environment.
Do this instead:
- Look up the method on the Test User Accounts page.
- Use the shared test account listed there, or create your own test account where the method requires it.
- If a method needs access from the provider, request it before you start testing.
6. Don't expect test signatures to be legally valid
Signatures and e-seals created in the test environment are made with test certificates. They aren't legally binding, and signature validators report them as invalid or untrusted, because test certificates aren't issued by trusted certificate authorities. This is expected and doesn't indicate a problem with your integration.
Do this instead:
- Use the test environment to check that your flow works from start to finish: the user can sign, your webhook fires, and you can download the signed file.
- Don't use test signatures on real agreements, and don't use sensitive documents or personal data in the test environment.
- To confirm that signatures pass validation, sign a document in the live environment.
Still stuck?
If you follow these rules and something still doesn't work, contact us. Include your client_id, the method, the environment, and the doc_id if you have one. Don't send your secret.