Supposing you're building an app (for instance, a voting app), and you want to restrict it to UNN students. Simply ask them to login with their UNN Portal details, and pass them to this API to verify their identity. (Please do not store those credentials 🙏).
There's only one endpoint: https://unn-api.herokuapp.com/students/auth
Make a POST request with the following parameters (form-data or application/json content types acceptable)
- username: The student s unnportal.unn.edu.ng username. Example: 2013/123456
- password: The student s unnportal.unn.edu.ng password
If the login was successful, you should get a response like this (note the capitalization):
{
"status": "success",
"data": {
"surname": "ADEBAYO",
"first_name": "SHALVAH",
"middle_name": "",
"sex": "Male",
"mobile": "080xxxxxxxx",
"email": "[email protected]",
"department": "ELECTRONIC ENGINEERING",
"level": "200 LEVEL",
"entry_year": "2010-2011",
"grad_year": "2019-2020",
"matric_no": "201x/xxxxxx",
"jamb_no": "xxxxxxxxxx"
}
}
For a failed login, you should get a response like this:
{
"status": "error",
"message": "Login failed. Please check your credentials and try again."
}
Note: for this API to work, it has to make 3 web requests to the UNN portal. To optimize repeat requests, the API caches student details for a period of 4 hours. This means if you are able to login successfully, subsequent API calls will load your details from cache. You can explicitly force it to re-authenticate by sending a Cache-Control: no-cache header
Building a PHP app? Instead of making requests manually, you could use this package. Makes working with this API a breeze!
(PS. feel free to build packages for other languages, and holla at me to list them here)