Submit a ticket My Tickets
Welcome
Login  Sign up

Single Sign-On: using OneFile as an Authentication provider

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
ParameterTypeUse
client_idAlpha numeric stringUsed to identify the connecting external service provider
redirect_uriStringUsed as the redirect url when user authentication is complete, this must match the redirect url that was inputted when setting up the client
stateStringUsed 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}
ParameterTypeUse
client_idAlpha numeric stringUsed to identify the connecting external service provider
redirect_uriStringUsed as the redirect url when user authentication is complete, this must match the redirect url that was inputted when setting up the client
codeStringUsed to validate the access token request for a user
client_secretStringUsed 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”
 }


Visual Representation

A
Adam is the author of this solution article.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.