GET login/info
Contents |
Description
Validates the token given to the callback_url and returns login information.
Use this API to validate the token received by the event socialid.events.onLoginSuccess or by the callback url configured in the Login App (more details in Social Login User Guide).
This API also returns some basic information of the user who logged in through the Login App Widget, such as name, location, email, picture_url and details of the credential used to perform the login. An optional field "fields" can be used to request additional fields.
Resource URL
GET https://api.socialidnow.com/v1/marketing/login/info
Parameters
URL Parameters
api_secret | required | Social Login App secret (available in the "Call the API" area of the Social Login App). |
---|---|---|
token | required | login token received in the callback_url. See Social Login Tokens for more details. |
fields | optional | a list of user profile field names to be returned, joined by commas. See Social Profile Fields. |
Authentication
This API does not require HTTP Basic authentication. The authentication is performed by the combination of api_secret and token parameters.
Response
The following fields are returned:
connection | user active connection url. |
---|---|
connection_id | user active connection id. |
credential | information of the credential the user used to login. |
user e-mail. Warning: this field is deprecated. Use "verified_email" field in the "fields" parameter. | |
id | user id. Warning: this field is deprecated. Use "user_id" field in the "fields" parameter. |
location | user current location. Warning: this field is deprecated. Use "current_location" field in the "fields" parameter. |
name | user name. Warning: this field is deprecated. Use "display_name" field in the "fields" parameter. |
picture_url | user picture url. Warning: this field is deprecated. Use "picture_url" field in the "fields" parameter. |
profile | a hash with the fields request by the parameter "fields". This field will only be present if at least one field is requested. |
user_id | user id. |
user_token | user token. This token is used as user identifier in some Javascript APIs. See Social Login Tokens for more details. |
Examples
Without fields
Request
Returns information from token "56732":
curl -X GET 'https://api.socialidnow.com/v1/marketing/login/info?api_secret=09876&token=56732' \ -H 'Accept: application/json'
Response
Response Body
{ "connection": "https://api.socialidnow.com/v1/marketing/login/connections/1234567890" "connection_id": "1234567890", "credential": { "access_token": "58272", "facebook_id": "434242" "type": "facebook", }, "email": "john.doe@some.domain.com", "id": 12345, "location": "San Francisco", "name": "John Doe", "picture_url": "https://facebook.com/picture.png", "user_id": 12345, "user_token": "12345678901234567890123456789012", }
With fields
Request
Returns information from token "56732" with profile fields birthday, gender and name:
curl -iX GET 'https://api.socialidnow.com/v1/marketing/login/info?api_secret=09876&token=56732&fields=birthday,gender,name' \ -H 'Accept: application/json'
Response
Response Body
{ "connection": "https://api.socialidnow.com/v1/marketing/login/connections/1234567890" "connection_id": "1234567890", "credential": { "access_token": "58272", "facebook_id": "434242" "type": "facebook", }, "email": "john.doe@some.domain.com", "id": 12345, "location": "San Francisco", "name": "John Doe", "picture_url": "https://facebook.com/picture.png", "profile": { "birthday": "1981-12-15", "gender": "male", "name": { "family_name": "Doe", "formatted": "John Doe", "given_name": "John", "honorific_prefix": null, "honorific_suffix": null, "middle_name": null } }, "user_id": 12345, "user_token": "12345678901234567890123456789012", }