This article explains how to use OneFile as an authentication provider. We provide an oAuth 2.0 integration.
Authorisation Request
GET
https://login.onefile.co.uk/auth?client_id={YOUR_CLIENT_ID}&redirect_uri={YOUR_REDIRECT_URI}&state={YOUR_STATE_TOKEN}&scope=user&response_type=code
Parameter | Type | Use |
client_id | Alpha numeric string | Used to identify the connecting external service provider |
redirect_uri | String | Used as the redirect url when user authentication is complete, this must match the redirect url that was inputted when setting up the client |
state | String | Used to validate the authorization response, preventing CSRF attacks |
This call will allow the user to authenticate, then return them to the redirect uri with an authorization code, which can then be used to request an access token this will look like this:
GET
{YOUR_REDIRECT_URI}?code={THE_GENERATED_AUTH_CODE}&state={YOUR_STATE_TOKEN}
From this you will then need to make an access token request, as shown below.
Access Token Request
POST
https://login.onefile.co.uk/token?client_id={YOUR_CLIENT_ID}&client_secret={YOUR_CLIENT_SECRET}&grant_type=authorization_code&redirect_uri={YOUR_REDIRECT_URI}&code={YOUR_AUTHORIZATION_CODE}
Parameter | Type | Use |
client_id | Alpha numeric string | Used to identify the connecting external service provider |
redirect_uri | String | Used as the redirect url when user authentication is complete, this must match the redirect url that was inputted when setting up the client |
code | String | Used to validate the access token request for a user |
client_secret | String | Used to validate that the request for the access token is coming from the external service provider that created the oAuth client |
This will respond with an access token that can be used to request information for the user.
ContentType: application/json { “access_token”: “{THE_ACCESS_TOKEN}”, “token_type”: “bearer” }
User Details Request
GET
https://login.onefile.co.uk/me
Headers:
Authorisation: {THE_TOKEN_TYPE} {THE_ACCESS_TOKEN}
N.B the space is important
Response:
ContentType : application/json { “UserID”: “” “FirstName”: “John”, “LastName”: “Smith” }