ABHA SDK Implementation
This guide provides everything you need to integrate the ABHA SDK into your application.Overview
The ABHA SDK allows you to integrate Create ABHA, Login with ABHA flows into your healthcare applications. It provides:- Create ABHA: Create a new ABHA using Mobile or Aadhaar
- Login with ABHA: Login with ABHA address[PHR Address], ABHA number, Adhaar number or Mobile number linked to your ABHA into your healthcare application.
Installation
Prerequisites
- A modern web browser.
- Your domain must be whitelisted with Eka Care to avoid CORS(Cross-Origin Resource Sharing) error. (Contact Eka Care to request API access and domain whitelisting.)
- A valid HTML container element where the SDK will mount.
Setup
Add the following HTML and script tags to your webpage:Core Functions
1. initAbhaApp
Initializes and renders the ABHA SDK in your specified container. Parameters:
Example:
Callback Parameters
onSuccess Callback
The onAbhaSuccess callback is triggered when the ABHA flow completes successfully. It returns verified user details and tokens, which can be used to log in or continue the user’s session. Callback Signature:
Example:
onError Callback
The onError callback is triggered whenever an ABHA flow fails or is interrupted. It provides details about the failure through structured parameters, allowing you to handle or forward the error appropriately (for example, to native apps or monitoring tools). Callback Signature:
Example:
Container Styling
Ensure your container has sufficient space:Complete Implementation Example
Type Definitions
Troubleshooting
Common Issues
1. SDK Not Rendering
Problem: Nothing appears in the container. Solution:- Ensure containerId matches an existing HTML element.
- Verify the SDK JS and CSS are correctly loaded.
- Check browser console for errors.
2. Callback Not Triggered
Problem: onSuccess or onError isn’t firing. Solution:- Make sure both callbacks are passed as valid functions.
- Avoid race conditions (e.g., calling before SDK fully loads).
3. Styling Issues
Problem: SDK content appears misaligned or clipped. Solution:- Give your container a fixed height (e.g., 600px).
- Ensure no parent element uses overflow: hidden.

