Authenticate a social login

Authenticate a social login
Open Recipe

Authenticates Social Login users. Note that you must use HTTPS to make this call.

During the authentication process, this operation retrieves profile information offorthe user. Using the apiKey of the social login application and the one-time social login token this endpoint returns the requested data from the identity provider.

Accepted content types

  • application/x-www-form-urlencoded
  • multipart/form-data

accessCredentials fields

The following list the fields found in the accessCredentials portion of the response for some of the more commonly used providers. Note that identity providers frequently change the values they return, meaning that this list might not be 100% accurate at any given time:

  • Amazon: accessToken, uid, expires, refreshToken, scopes.
  • Facebook: accessToken, expires, uid, type.
  • Google: oauthToken, oauthTokenSecret, scopes, type.
  • LinkedIn, Twitter: oauthToken, oauthTokenSecret, type.
  • Mixi: accessToken, refreshToken, expires, scopes.
  • QQ: accessToken, uid, scopes, type.
  • Renren: type, oauthToken, uid, expires.
  • Sina Weibo: type, oauthToken, uid.
  • VK: accessToken, uuid, expires, scopes, types.
  • Microsoft Account: eact, type.

Provider fields

The list below shows the fields found in the provider section of the response, listed by provider. Again, identity providers frequently change the values they return, meaning that this list might not be 100% accurate at any given time:

  • Facebook: albums, games, groups, videos.
  • Foursquare: type, pings, relationship.
  • LinkedIn: associations, patents, numRecommenders, industry, following, courses, certifications, publications, positions, jobBookmarks, honors, groupMemberships, mFeedRssUrl, skills, proposalComments, recommendations, volunteer.
  • Mixi: occupation, bloodType, favoriteThings.
  • SalesForce: local, userType, active.

Authentication

This operation uses your social login API key for authentication. This key can be found on the Settings page of the Social Login dashboard. See Get started for more information.

Base URL

The base URL for this operation is your application domain followed by /api/v2; for example:

https://educationcenter.rpxnow.com/api/v2

You can find your application domain in the Social Login dashboard on the Settings page:

Example request

This command authenticates a social login user.

curl -X POST \
  --data-urlencode apiKey=1234567891234567891234567891234567891234\
  --data-urlencode token=a1b2c3d4e5f6g7h8i9j0\
  https://janrain-docs.rpxnow.com/api/v2/auth_info

Example response

If your API call succeeds you'll get back information about the newly-authenticated user:

{
  "profile": {
    "name": {
      "givenName": "Sam",
      "familyName": "Knot",
      "formatted": "Sam Knot"
    },
    "verifiedEmail": "sam@example.com",
    "googleUserId": "123456789123456789123",
    "displayName": "sam",
    "preferredUsername": "sam",
    "url": "https://www.google.com/profiles/123456789123456789123",
    "providerName": "Google",
    "identifier": "https://www.google.com/profiles/123456789123456789123",
    "email": "sam@example.com"
  },
  "accessCredentials": {
    "scopes": "Blogger,Google Buzz,Google Contacts,YouTube,Picasa Web Albums,Google Calendar,Google Docs",
    "oauthToken": "1/1234567891234567891234567891234567891234567",
    "type": "OAuth",
    "oauthTokenSecret": "123456789123456789123456"
  },
  "merged_poco": {
    "urls": [
      {
        "type": "other",
        "value": "https://www.google.com/profiles/123456789123456789123"
      }
    ],
    "preferredUsername": "Sam",
    "name": {
      "formatted": "Sam Knot",
      "familyName": "Knot",
      "givenName": "Sam"
    },
    "languagesSpoken": [
      "en"
    ],
    "emails": [
      {
        "type": "other",
        "value": "sam@example.com"
      }
    ]
  },
  "stat": "ok"
}

Parameters

Parameters can be configured as x-www-form-urlencoded or as multipart/form-data body parameters.

ParameterTypeRequiredDescription
apiKeystringSocial login secret for authenticating the operation. To verify your API key, log in to Console and, on the Manage Application page, check the value of the rpx_key setting. This value also appears on the Settings page in the Social Login dashboard.
extendedbooleanIf true, the operation returns user data in the Simple Registration and hCard formats in addition to the default format. These formats provide ways to exchange user profile data with other websites.
tokenstringAccess token from the social login identity provider.
tokenUrlstringValidates the specified token URL value against the URL in the original request.

Response sections

Note that the sections of an API response depend on the social login identity provider. Not all responses includes all the possible response sections.

SectionTypeDescription
profiledictionaryDictionary of fields that make up the user's profile. This data may have been obtained through SREG (Simple Registration Extension) or HCard, but is represented in the standard Portable Contacts schema.
accessCredentialsdictionaryIf the user logged in with a provider that allows posy-authentication account access, this section contains the user's authorization credentials. The fields returned vary by provider and are referenced in the "accessCredentials Fields" section at the top of this page.
merged_pocodictionaryMerged Portable Contacts data is returned if the extended request parameter was set to true and if extended profile information is available.
friendsarrayFriend identifiers are returned if the extended request parameter was set to true and if extended friend information is available.
followingarraySupportedonly by Twitter, Sound Cloud, and Sina Weibo. People that the user follows are returned if the extended request parameter was set to true and if this information is available.
friendshipsarraySupported onlyby Twitter, Sound Cloud, and Sina Weibo only. People that the user follows and that also follow the user are returned if the extended request parameter was set to true and if this information is available.