DigiLocker (India)
Built: 2026-11-02. For the operator setting up driver onboarding in India, and for whoever maintains the code.
DigiLocker is the Government of India's document locker. Issuing authorities put their own records in it:
- UIDAI puts in the Aadhaar eKYC;
- state transport departments put in the driving licence and the vehicle RC.
With DigiLocker set up, a driver can bring these into their KYC in one consent, instead of photographing each document.
What the driver sees
- Start. Onboarding (step 2) and Menu → Documents show Get your documents from DigiLocker. The card is hidden until DigiLocker is set up, so other markets never see it.
- Consent. Continue with DigiLocker opens DigiLocker in the phone's browser. The driver signs in there and allows access.
- Back in the app. DigiLocker returns to the server, which imports the
documents. The browser then hands back to the app, which says how it went:
- "3 documents added";
- "access wasn't allowed";
- "the link expired";
- "couldn't bring your documents".
- The checklist. It reloads with the new documents. If the Aadhaar name differs from the driver's profile name, the card says the team will check it.
What is imported
| From DigiLocker | Becomes | Kept |
|---|---|---|
Aadhaar eKYC (/3/xml/eaadhaar) |
The market's identity document: national_id if the market requires it, otherwise id_proof (India's preset) |
The XML with the photo removed and the number masked; details: name, birth date, gender, last 4 digits, district, state |
Driving licence (doctype DRVLC) |
license |
The issuer's file (PDF or XML); details: issuer, document name, DigiLocker URI |
Vehicle registration (doctype RVCER) |
vehicle_registration |
The same |
Nothing else in the locker is fetched. A marksheet in the locker, for example, is never fetched.
Aadhaar. The Aadhaar Act forbids storing the number. Only the last four digits are kept, and the stored XML never holds more. The photo is removed from it.
When documents are approved automatically
The imported documents are the issuers' own records. They are approved without review only when the Aadhaar shows they belong to the driver:
- the Aadhaar name matches the profile name. Case, spacing and word order don't matter.
- A driver with no profile name yet takes the Aadhaar's name, and their documents are approved.
Otherwise every document from that consent waits for an operator, like an upload. This covers:
- an Aadhaar in another name, which means someone else's DigiLocker;
- a locker with no Aadhaar, where nothing ties the licence to the driver.
In Admin → Drivers → KYC, each such document reads:
- "DigiLocker · issuer-verified";
- the issuer;
- for the Aadhaar, the last four digits;
- when the names differ, "Aadhaar name "…" differs from the profile".
An operator can reject an approved one like any other document.
Setting up (Admin → Providers → DigiLocker)
First, register as a DigiLocker partner (Requester). This is done at partners.digilocker.gov.in. It gives you a client ID and secret. Register the callback URL below with them.
| Field | What to put |
|---|---|
| Partner client ID / secret | From the DigiLocker partner portal |
| Environment | production or sandbox |
| Callback URL | Leave blank to use <your API>/kyc/digilocker/callback. It must be exactly the URL registered with DigiLocker. |
| Driver app return link | Leave blank for ridekitdriver://digilocker. If you changed the driver app's scheme, put <scheme>://digilocker. |
| API base URL | Leave blank to use the official host for the environment. Set it only if DigiLocker gives you a different one; it has moved hosts before. |
The keys can also come from environment variables:
DIGILOCKER_CLIENT_IDDIGILOCKER_CLIENT_SECRETDIGILOCKER_ENVIRONMENTDIGILOCKER_CALLBACK_URLDIGILOCKER_APP_REDIRECTDIGILOCKER_BASE_URL
Until the client ID and secret are set:
- drivers don't see the card;
POST /driver/digilocker/startanswersdigilocker_not_configured.
Before going live, confirm with DigiLocker:
- which document types your partner account is allowed to pull;
- the current API host.
Security
- Consent flow. OAuth 2 authorisation code with PKCE (S256). The code verifier never leaves the server.
- State. Each consent has a one-time
statethat lasts 15 minutes. The callback claims it atomically, so a replayed or late callback imports nothing. - Callback. It is public, because the browser lands there. It always answers with a redirect into the app, never an error page.
Code
| Piece | Where |
|---|---|
| Protocol helpers (PKCE, authorize URL, eAadhaar parse/redact, name match) | backend/src/kyc/digilocker.ts |
| Start, callback, import | backend/src/kyc/digilocker.service.ts |
Endpoints (GET/POST /driver/digilocker, GET /kyc/digilocker/callback) |
backend/src/kyc/digilocker.controller.ts |
| Issuer documents into KYC | driver-kyc.service.ts (recordFromIssuer), driver-documents.service.ts (trustedXml) |
| Migration | 1700000113000-DigilockerSessions |
| Driver app | src/components/DigilockerCard.tsx, app/(app)/digilocker.tsx |
| Admin | KYC rows in app/(dashboard)/drivers/[userId]/page.tsx; fields in providers/page.tsx |
| Tests | kyc/digilocker.spec.ts; app DigilockerCard.test.tsx, DigilockerReturn.test.tsx |
Not built
- Expiry dates. Expiry dates are not read from the issuer's licence. The file is often a PDF, so an operator enters the expiry if the expiry sweep should track it.
- Names on the licence and RC. They are not compared. An RC is often in the vehicle owner's name, which is normal for fleets.
- Other countries. UAE Pass (AE) and Nafath (SA) are separate items in their markets.