Quick Start

myinfo-connector-python is built with Django to make easy-to-go application.

Step 1: Clone the repository in your local

git clone git@github.com:leeleelee3264/myinfo-connector-python.git

Step 2: Install Pre-requisite

Install Python

You can exclude python 3 is already installed in your local.

brew install python@3.8 pipenv

Set Python Path in ~/.zshrc

export PATH="/opt/homebrew/opt/python@3.8/bin:$PATH"

Refresh ~/.zshrc

source ~/.zshrc

Step 3: Install packages

PIPENV_VENV_IN_PROJECT=1 
cd ~/myinfo-connector-python
pipenv install 

Step 4: Start server

Make your request

To make your first request, call apis in order.

Step 1: Get myinfo redirect login url

Get login url to redirect to myinfo

GET http://localhost:3001/users/me/external/myinfo-redirect-login

Get login url to redirect to myinfo. This url contains attributes about person data requested to myinfo.

url: url to redirect to myinfo.

state: Identifier that represents the user's session/transaction with the client for reconciling query and response. The same value will be sent back via the callback URL. Use a unique system generated number for each user/transaction.

Step 2: Browse myinfo redirect login url

Step 3: Do login and check agree terms

Myinfo Login Page

Myinfo Terms Agreement Page

(Automated) Step 4: Callback API get called by Myinfo

After login, Myinfo call our callback api to pass auth code as a response.

Callback called by Myinfo service

GET http://localhost:3001/callback

After login Myinfo and agree terms, Myinfo service automatically call myinfo-connector-python's callback API to pass auth code.

Query Parameters

Name
Type
Description

code*

String

The authcode given by myinfo's authorise API

state*

String

Identifier that represents the user's session/transaction with the client for reconciling query and response. The same value will be sent back via the callback URL. Use a unique system generated number for each user/transaction.

callback url example

Our callback api return simple HTML page to

  • get callback from Myinfo

  • call api for person data automatically right after the callback api called.

Response Page for callback api

(Automated) Final Step: Get Person data from Myinfo

After callback, callback page automatically calls our api for person data

Get person data from myinfo

GET http://localhost:3001/users/me/external/myinfo

Get person data from myinfo. The API is final step of myinfo-connector-python

Query Parameters

Name
Type
Description

code

String

The authcode given by myinfo's authorise API

regadd: Registered Address of Person (including FIN holders)

dob: Date of Birth of Person.

sex: Sex of Person.

name: Full Name of the Person.

birthcountry: Country of Birth of Person. Refer to country in code table provided HERE for description of each code.

nationality: Nationality of Person. Refer to the Code reference tables in the Support section for list of possible values.

unifin: Singapore issued identification number of the Person.

Last updated