MOSIP Form Authentication
Overview
The MOSIP form integration provides helper functions that render eSignet authentication and QR code identity verification components directly in OpenCRVS declaration forms. These helpers are defined in src/events/mosip.ts in the reference testland country configuration.
Three main helper functions are available:
getMOSIPIntegrationFields
Generates the full set of form fields for E-Signet authentication and QR verification
connectToMOSIPIdReader
Wraps individual form fields to receive values from the ID reader or E-Signet response
connectToMOSIPVerificationStatus
Lower-level helper to add conditional show/hide/disable logic based on verification status
getMOSIPIntegrationFields
This function generates the form fields required for MOSIP identity authentication on any form page. It is used for Informant, Mother, Father, Spouse, and Deceased roles across birth and death events.
Example from src/events/birth/forms/pages/mother.ts:
import {
getMOSIPIntegrationFields,
connectToMOSIPIdReader,
connectToMOSIPVerificationStatus
} from '@countryconfig/events/mosip'
// In the form page configuration:
...getMOSIPIntegrationFields('mother', {
existingConditionals: [
{
type: ConditionalType.SHOW,
conditional: requireMotherDetails
}
]
})The fields generated include:
VERIFICATION_STATUS — Displays the current identity status (authenticated, verified, pending, failed).
QUERY_PARAM_READER (when
esignet: true) — Reads OAuth callback parameters (code,state) from the URL.HTTP (when
esignet: true) — Fetches user info from the MOSIP API user info endpoint using the OAuth code.LOADER (when
esignet: true) — Shows a loading indicator while the HTTP request is in flight.ID_READER — Renders the authentication method chooser:
A LINK_BUTTON for eSignet authentication (when
esignet: true)A QR_READER for offline QR code scanning
connectToMOSIPIdReader
This function wraps a form field to receive its value from the MOSIP identity system. It connects the field to both the eSignet response (verify-nid-http-fetch) and the QR code reader (id-reader).
Example:
The second parameter configures:
valuePath— The path within the HTTP response or QR data where the field value is found.disableIf— Statuses at which the field should be disabled (preventing edits after authentication/verification).hideIf— Statuses at which the field should be hidden.
connectToMOSIPVerificationStatus
A lower-level helper that adds conditional logic to any form field based on the current verification status. It upserts SHOW and ENABLE conditionals:
eSignet authentication URL
The eSignet redirect URL is constructed in the LINK_BUTTON configuration within getMOSIPIntegrationFields:
The ESIGNET_REDIRECT_URL and OPENID_PROVIDER_CLIENT_ID environment variables are configured in src/environment.ts.
Offline identity verification via ID Auth
When eSignet is unavailable (offline registration), identity data can be captured via QR code scan or manual entry using the QR_READER component. Once the system is back online, the submitted data is verified against the MOSIP ID Auth SDK through the mosipInteropClient.verifyNid() call in the action handler.
This verification happens in the onBirthActionHandler and onDeathActionHandler in src/api/events/handler.ts.
Form pages using MOSIP integration
The helpers are used across the following form pages:
Birth:
Death:
Last updated