Passport Validate Login
After the user has logged in on their social media account, the passport service will redirect back to a page within your website. In this page you need to call the following api and pass on the query params that were sent in the callback URL.
General Information
Service | API | Method |
|---|---|---|
urac | /passport/validate/:strategy | GET |
Workflow: Passport Validate Flow
Input
Type: application/json
Name | Source | Mandatory | Type | Special Format | Description |
|---|---|---|---|---|---|
strategy | Route Param | YES | String | N/A | facebook, google, twitter |
code | Query | NO | String | N/A | The code is passed if the strategy is google or facebook |
oauth_verifier | Query | NO | String | N/A | The "oauth_verifier" is passed if the strategy is twitter |
oauth_token | Query | NO | String | N/A | The "oauth_token" is passed if the strategy is twitter |
Output
Valid Response
Valid Response Sample
{
"result": true,
"data": "..."
}
Invalid Response
Error Response Sample
{
"result":false,
"errors":{
"codes":[399],
"details":[
{
"code":399,
"message":"Missing Service config. Contact system Admin"
}
]
}
}
Error Codes
Code | Description |
|---|---|
399 | Missing Service config. Contact system Admin |
499 | The token has already been used |
Example (CURL)
Request
Calling API
> CURL -X GET http://127.0.0.1:4000/urac/passport/validate/facebook?code=1236337 Response
Login API response
{
"result": true,
"data": {
"_id": "582f11552f19cc5de6727dff",
"username": "10153921831136546",
"firstName": "john ",
"lastName": "Doe",
"email": "user@gmail.com",
"status": "active",
"ts": 1479479637100,
"groups": [],
"config": {},
"profile": {},
"socialLogin": {
ts: 1491295995775,
"strategy": 'facebook',
"id": "10153921831136546"
},
"accessTokens": {
token_type: 'bearer',
access_token: 'd2e7fa04876df59f8eb80fa60573ea8039b7c642',
expires_in: 7200,
refresh_token: '29f3c07066fff8623adb7b4ac2cbd70d51d0bfe0'
}
},
"soajsauth": "Basic c29hanM6QzAxdmZzUWE5dEN2S3R6RzFfVXRNVFZobVF0UjRYX3RYSFE="
}