MOSIP Authentication SDK
Overview
The MOSIP Authentication SDK is a (Python-based) wrapper designed to simplify interaction with the MOSIP Authentication Service, enabling seamless integration of robust identity verification workflows into Python applications. This SDK abstracts complex details such as request/response structures, encryption/decryption mechanisms, and error handling, allowing developers to implement authentication workflows quickly and efficiently. Currently, the SDK supports OTP authentication and demographic authentication. Future updates will expand its functionality to include biometric authentication. Additionally, although the SDK is currently Python-based, we will soon be expanding support to other languages to offer broader compatibility.
Purpose
This page provides an overview of the Authentication SDK, outlining its functionality and providing a detailed process for installing and testing the IDA API using the SDK.
Why Use This SDK?
While building your solution around MOSIP, it is recommended to use eSignet, MOSIP's OAuth- and OIDC-based solution, for most online and scalable authentication needs due to its modern, standards-compliant design. However, the MOSIP Authentication SDK offers its own advantages, particularly in the flexibility it provides, making it an invaluable tool for addressing a wide range of identity verification requirements.
Ease of Integration: Simplifies the process of working with MOSIP’s APIs, reducing the learning curve for developers
Consistency: Provides a uniform interface for different authentication operations, ensuring a consistent experience
Security: Manages encryption and decryption of requests and responses, adhering to MOSIP's security standards
Flexibility: Supports multiple authentication methods, including demographic authentication, offering versatility in identity verification workflows
Key Features
Simplified API Interaction: Abstracts the complexity of direct API calls to MOSIP services
Support for Multiple Authentication Workflows: Includes controllers for both KYC-based and general authentication
Comprehensive Configuration: Allows customization via a configuration file (authenticator-config.toml)
Secure Handling: Automatically encrypts requests and decrypts responses to ensure secure communication
Error Management: Provides clear error messages and handling mechanisms
Controllers
The SDK provides two primary controllers, each designed for a specific authentication workflow:
kyc-auth-controller Used for Know Your Customer (KYC) authentication. This controller facilitates verification using demographic data or OTP verification. Reference: KYC Auth Controller API Documentation
auth-controller Used for general authentication of individuals, allowing verification based on a wide range of identifiers such as demographic authentication and OTP authentication. Reference: Auth Controller API Documentation
Method Reference
The SDK provides two key methods for authentication:
kyc Method: Used for KYC-based authentication by verifying an individual's demographic data and OTP.
auth Method: Handles general authentication requests with similar parameters as kyc.
Both methods require the individual's ID (individual_id), ID type (individual_id_type), demographic data (DemographicsModel), optionally an OTP, biometric data, and consent confirmation. These methods streamline identity verification processes for diverse use cases. Please refer below to know more about the methods.
kyc Method
Authenticates an individual using KYC-based workflow.
auth Method
Performs a general authentication.
Common Parameters
individual_id (str): The unique ID of the individual (e.g., VID, UIN)
individual_id_type (str): Specifies the type of ID used (e.g., VID, UIN)
demographic_data (DemographicsModel): A model containing demographic details such as name and address
otp_value (Optional[str]): The One-Time Password (OTP) for authentication, if applicable
consent (bool): Indicates if the individual has given consent for authentication
Installation Process
Pre-requisites:
Before beginning the installation and configuration of this SDK, the user must complete the following steps:
Register as an Authentication Partner (AP): Register their organization as an Authentication Partner. Please refer to this link here and follow the steps for registration.
Obtain the IDA-FIR(K21) Certificate: The user must possess the IDA-FIR(K21) certificate. The certificate can be obtained here.
Provide required details in the request:
app id: IDA
ref : IDA-FIR
Install pip on the machine: The user should install pip to manage Python packages. Installation instructions can be found here.
Configuration
During installation, the SDK must be configured by updating the authenticator-config.toml file. Please refer to this link here for the configuration file, This file contains essential details, such as:
Service Endpoints
Encryption Keys
Timeout Settings
Logging Settings
Refer to this link here for a sample configuration file to guide you in the setup process.
Installation
Install the SDK using pip:
Usage
Users who wish to try out this SDK should follow these steps:
Initialize the Authenticator: Set up the authentication instance to begin interacting with the SDK
Create Demographic Data: Prepare the necessary demographic information required for authentication
Perform Authentication: Execute the authentication request using the SDK
Handle the Response: Process and utilize the response received from the authentication service
For detailed guidance on performing these steps during the installation process, please refer to the model implementation below.
Basic Example:
Error Handling
The SDK provides clear error messages and codes to help diagnose issues effectively. Review the errors field in the response for details.
Encryption and Decryption
All communication with the MOSIP service is securely encrypted. Use the decrypt_response method to handle encrypted responses appropriately.
Conclusion
The MOSIP Authentication SDK simplifies the integration of robust authentication workflows into Python applications, ensuring secure, efficient, and compliant identity verification. By abstracting the complexities of direct API interaction, the SDK enables developers to focus on building impactful solutions without having to manage intricate implementation details.
Get in Touch
If you require any assistance or encounter any issues during the testing and integration process, kindly reach out to us through the support provided below.
Navigate to Community.
Provide a detailed description about the support you require or provide complete information about the issue you have encountered, including steps to reproduce, error messages, logs and any other required details.
Thank you. Wishing you a pleasant experience!
Last updated