Aadhaar Verification in Laravel

Tamil Raja
Jan 18, 2017 · 3 min read

A centralized Identity system a la SSN in the USA has been sorely lacking in India. But with the critical mass Aadhaar scheme has gained and the API ecosystem maturing around it, finally we have a viable option for identity.

We have been leveraging this in many applications to implement disruptive use cases like social lending.

Here, we are going to show how to integrate Aadhaar verification using Aadhaar Bridge in Laravel.

Aadhaar Bridge Flow Diagram

Following are the steps to achieve the verification process

  1. Create Digital Signature Agreement
  2. IP White listing
  3. Server Setup
  4. Integration with Laravel

1. Create Digital Signature Agreement

To create a digital agreement, we have to register in the Aadhaar Bridge website. There are four Aadhaar verification transactions available. We have created an account in the Aadhaar Bridge for “AUTH” Aadhaar transaction.

Click on the link and perform the “Sign-Up” process. After this, the User will receive the User Activation link via Email post which the User should create an account.

To create the Digital Agreement(SUB AUA Agreement) we have to log in to the site and download the agreement. Upload the signed agreement in the same Aadhaar Bridge URL as shown in the figure below. Once the agreement verification and validation are performed, the account will be activated.

2.IP Whitelisting

To Whitelist the IP from which our request will be originating, we have to create .cer file and upload in the following form:

2.1 Create private key with a validity

2.2 Create CSR (Certificate Signing Request) for above key

Details to be ensured while generating the “CSR” through the terminal window by the customer:

  • ALIAS_NAME : This could be anything.
  • COMP_NAME : This could be anything.
  • COMMON_NAME : This should be the same as the contact person’s name.
  • sample@abc.com : This should be same as the login email id.
  • ORG_UNIT : Value should be “Khosla Labs”
  • ORGANIZATION_NAME : This should be same as the organization name in the Sub-AUA’s profile for an organization. Can be anything for an individual.

Generation of a new Certificate: Once the CSR file is generated, generate the certificate by uploading the CSR on the same page itself. If the CSR file is validated, a certificate will be generated and thereafter will be shown on the screen. Download the certificate and save it in the local system.

3.Server Setup

To setup the server we need to download the setup zip file from the following link:
Resources –>JAVA DEVELOPERS

Setup Zip file will contain the .jar and application.properties file. We need to configure the application.properties file to complete the server setup.

Generating and adding the P12 file path is one of the important configuration processes. Run the following command to generate the P12 file

In the application properties file, enter the configuration based on our profile. URLs for the same are mentioned below:

Property Endpoint

  • keystore.location P12 file location
  • keystore.pass Password (Same password what we have used to generate the .jks file)
  • keystore.alias Alias name
  • x09cert.location .cer file location
  • aua.host.auth.url https://bridge.aadhaarconnect.com/aua/auth
  • subaua.code SUB AUA Code
  • timeout.in.sec Time limit
  • server.port Port number

Once the properties file is configured with our certificate location, keystore passcode, service URL and SubAUA code, run the gateway application using the following command:

(Note : On Executing the command, the JAR will auto-launch the Tomcat server, which requires Java-7 to be installed on our server.)

4.Integration with Laravel

Here are a few code snippets for the Laravel API calls.

Sample Base URL: http://128.199.50.45:5181 (server is running on IP 128.199.50.45 at port 5181)

Add the following route in the routes.php:

Add the following controller file AadhaarVerificationController.php with function adhaarVerification

Sample API call for Aadhaar verification:

Input:

Output:

Ideas2IT

Craftsmen & engineers for startups and scale-ups — We are a crack team of startup nerds, valley veterans, and a platoon of dev ninjas. Visit us http://www.ideas2it.com

Tamil Raja

Written by

Ideas2IT

Ideas2IT

Craftsmen & engineers for startups and scale-ups — We are a crack team of startup nerds, valley veterans, and a platoon of dev ninjas. Visit us http://www.ideas2it.com

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade