Skip to main content

Securing Didit API Access with JWTs and Microservices

Learn how to secure your API access to Didit's powerful identity verification platform using JSON Web Tokens (JWTs) and robust microservice patterns.

Securing Didit API Access with JWTs and Microservices

Contents

In this guide

Jump to the part you need.

Robust Authentication with JWTsJSON Web Tokens (JWTs) offer a secure, stateless, and scalable method for authenticating microservices interacting with Didit's API, ensuring that each request is properly authorized without relying on session-based state.

Microservice Architecture for Enhanced SecurityImplementing microservice patterns for API access allows for granular control over permissions, isolation of sensitive operations, and improved resilience against security breaches.

Managing API Keys SecurelyAPI keys, like those provided by Didit, are critical for initial access and should be treated with utmost care, stored securely, and rotated regularly to minimize risk.

Didit's Developer-First Approach Simplifies IntegrationDidit provides a developer-friendly platform with programmatic login, clear API documentation, and a modular architecture that simplifies the integration of secure authentication and authorization patterns for identity verification workflows.

In today's interconnected digital landscape, securing API access is paramount, especially when dealing with sensitive identity verification data. As businesses increasingly adopt microservice architectures and rely on external services like Didit for identity verification, robust authentication and authorization mechanisms become non-negotiable. This blog post delves into how JSON Web Tokens (JWTs) and microservice patterns can be leveraged to secure your interactions with Didit's API, ensuring data integrity and compliance.

The Importance of Secure API Access for Identity Verification

Identity verification involves handling highly sensitive personal information. Any compromise of API access could lead to severe data breaches, regulatory penalties, and a loss of customer trust. Therefore, implementing stringent security measures is not just a best practice; it's a necessity. Didit, as an AI-native identity platform, processes critical data for services like ID Verification, Passive & Active Liveness, and AML Screening. Ensuring that only authorized microservices can access this data is fundamental to maintaining a secure ecosystem.

Traditional authentication methods, such as basic authentication or session cookies, can present challenges in a microservice environment due to their stateful nature and potential for scalability issues. This is where JWTs shine, offering a stateless, self-contained, and cryptographically signed token for authentication and authorization.

Leveraging JSON Web Tokens (JWTs) for API Authentication

JWTs are an open, industry-standard RFC 7519 method for representing claims securely between two parties. They are particularly well-suited for microservice architectures because they are:

  • Stateless: The server doesn't need to store session information. Each JWT contains all the necessary information, reducing server load and improving scalability.
  • Self-contained: JWTs carry information about the user and permissions, eliminating the need for multiple database queries for each API call.
  • Cryptographically signed: The signature ensures that the token hasn't been tampered with, providing integrity and authenticity.

When interacting with Didit's API, your microservice can obtain an access token through programmatic login. Didit's Auth API allows for programmatic login with email and password for API accounts, returning access and refresh tokens directly. This process is designed to be agent-friendly, enabling seamless integration without browser-based interactions. The returned access_token is then included in the Authorization header of subsequent API requests to Didit, granting access to specific functionalities based on the token's embedded claims.

For example, after a successful programmatic login, you might receive an access_token that grants your microservice permission to initiate ID Verification sessions or retrieve results from AML Screening. The expiration time (expires_in) included in the token response dictates how long the token is valid, necessitating a refresh mechanism using the refresh_token to maintain continuous access.

Microservice Patterns for Enhanced Security and Scalability

Adopting microservice patterns significantly enhances API security by promoting modularity and isolation. Instead of a monolithic application with a single point of failure, microservices allow you to segregate different functionalities, applying specific security policies to each. Here are some key patterns:

  • API Gateway: An API Gateway acts as a single entry point for all API requests, routing them to the appropriate microservice. It can handle authentication, rate limiting, and request validation before forwarding requests, adding a crucial layer of security.
  • Service-to-Service Authentication: When microservices need to communicate internally, they should also authenticate and authorize each other. This often involves using internal JWTs or other secure tokens.
  • Least Privilege Principle: Each microservice should only have the necessary permissions to perform its designated tasks. For instance, a microservice responsible for initiating ID Verification should not have access to sensitive customer databases, and vice-versa.
  • Secrets Management: API keys, database credentials, and other sensitive information should be stored in a dedicated secrets management system (e.g., HashiCorp Vault, AWS Secrets Manager) rather than hardcoded in the application.

Didit's architecture aligns perfectly with these patterns. Its modular nature means you can integrate specific identity primitives—like ID Verification, Passive & Active Liveness, or NFC Verification—into dedicated microservices. This allows you to build highly secure and scalable workflows. For instance, one microservice might handle the initial user onboarding (using Didit's ID Verification), while another might periodically run compliance checks (utilizing Didit's AML Screening & Monitoring).

Managing API Keys and Credentials Securely

While JWTs handle ongoing authentication, the initial access to Didit's API, especially for programmatic registration and email verification, often involves API keys and client IDs. Didit's programmatic email verification endpoint, for example, returns not only access tokens but also an api_key and client_id upon successful verification. These credentials are vital.

Best practices for managing these credentials include:

  • Secure Storage: Never hardcode API keys directly into your codebase. Use environment variables, configuration management tools, or dedicated secrets management services.
  • Rotation: Regularly rotate your API keys. If a key is compromised, frequent rotation limits the window of exposure.
  • Principle of Least Privilege: Ensure that the API key used by a microservice only has the permissions required for its specific tasks.
  • Monitoring: Monitor API key usage for any anomalous activity that might indicate a compromise.

Didit's developer-first approach simplifies this by providing clear documentation on how to obtain and use these credentials securely, making it easier for developers to integrate robust security practices from the outset.

How Didit Helps

Didit is engineered to be an AI-native, developer-first identity platform, making it incredibly easy to integrate secure verification into your microservice architecture. Our platform is built on open, modular identity primitives, allowing you to compose verification workflows precisely to your needs. With Didit, you get:

  • Programmatic API Access: Our Auth API enables programmatic login and credential retrieval (client_id, api_key, access_token) without human intervention, ideal for automated microservice deployments.
  • Modular and Composable Services: Integrate specific identity checks like ID Verification, Passive & Active Liveness, 1:1 Face Match, AML Screening & Monitoring, or Age Estimation as needed, giving you granular control over data access and processing.
  • Developer-First Ecosystem: An instant sandbox, comprehensive public documentation, and clean APIs ensure that securing your integration is straightforward and efficient.
  • Core KYC: Start building and testing your secure microservice integrations with Didit's Core KYC, and use pay-per-use pricing to implement robust security patterns without upfront costs.
  • No Setup Fees: Our transparent pricing model means you only pay for successful verifications, further lowering the barrier to entry for secure, scalable identity solutions.

Didit acts as your data processor, and you remain the data controller, giving you full control over data retention policies. You can configure retention periods from 1 month to 10 years, or even manually delete individual sessions directly from the Business Console, supporting your GDPR and local data protection obligations.

Ready to Get Started?

Ready to see Didit in action? Get a free demo today.

Start verifying identities for free with Didit's free tier.

Try it

Try this in the sandbox

Run the check this guide describes, free.

ID Verification

The product this post is about, taken from its topic. Run it free in the sandbox.

$0.15 per checkStart free

Author

Alberto Rosas

Co-founder and CEO

Alberto Rosas

Alberto Rosas

Co-founder and CEO

About Didit

Questions

Blog questions

Who writes the Didit blog?
The Didit team. Guides reviewed by Alberto Rosas, co-founder and CEO, carry his byline. The rest are published as Didit.
Which topics does the blog cover?
Eight topics: ID verification, business verification (KYB), AML, sanctions and compliance, fraud prevention, transaction monitoring and crypto, country guides, agents and developers, and product updates.
Is the blog available in my language?
Yes, in 15 languages: English, Spanish, French, German, Brazilian and European Portuguese, Catalan, Russian, Arabic, Chinese, Japanese, Hindi, Indonesian, Korean and Swahili. Not every post is translated, so each language shows the posts it has.
Where do I find product updates?
In the changelog at /changelog/ and under the Product updates topic.
Are these posts legal advice?
No. Regulation posts explain rules; your legal team decides how they apply.
How do I find posts on one topic?
Open one of the eight topics, or search the blog.
Are posts dated?
Yes. Every post shows when it was published and when it was last updated.
Do posts link to the docs?
Developer posts link to the matching page on docs.didit.me and to the API reference.
Is the blog the same as the docs?
No. The blog explains rules, markets and product changes for a general reader, while docs.didit.me holds the integration guides and the API reference. Developer posts link the matching docs page and the API reference they describe.

Compliance built in

Audited, certified and attested.

We hold the certifications and build each country's rules into your flows, so you can launch anywhere without worrying. Security and Compliance center

  • Regulation encoded into your flows

    Tell us what you do and where. Didit lists the rules that apply to you, with sources, and builds the checks each country needs into one workflow.

  • Ready for AMLR

    Every requirement of the new EU anti-money laundering rules, from checking customers to human review, is already covered by a Didit check.

  • Tested in Spain's Treasury sandbox

    Spain's Treasury published its supervised sandbox report on Didit's NFC plus active liveness onboarding; SEPBLAC took part and valued the added measures positively.

  • Audited, not self-declared

    iBeta Level 1 and Level 2. Liveness tested under ISO/IEC 30107-3.

Compliance assistant

Your obligations · 3 regions

EU · AMLRCustomer due diligence, human reviewCovered
Illinois, Texas, ColoradoExplicit biometric consentCovered
Germany · Youth protectionVerified adults only (JMStV)Covered
Workflow checked. Every obligation is met
  • SOC 2 Type 2
  • ISO 27001
  • iBeta Level 1 and Level 2
  • EU regulator attestation
  • FSM youth protection
  • GDPR
  • EBA remote onboarding
  • MiCA compatible
  • FIDO Alliance member
  • AMLREU AML Regulation ready

Integration · Didit MCP

Run Didit from your own AI agent

Connect Didit to Claude, Cursor, VS Code or ChatGPT and just ask in plain words. Your agent can do anything you can do in the console, with the same permissions you have.

Add to ClaudeChatGPT
Didit Academy · Lesson 04 · Use Didit with MCP
  • Build workflowsDescribe the checks you need. The agent creates and publishes the flow.
  • Run investigationsAsk why a session was declined, review cases, search people and companies.
  • Change rulesCreate payment rules, test them on past data and switch them on.
  • Pull reportsAsk for numbers, exports or the audit log.

Verify your first user today.

Start free

Free sandbox. Credit applies to work-email sign-ups.