Exchange a social login token for an access token

Exchange a social login identity provider access token
Open Recipe
Sign In with Apple
Open Recipe

This operation exchanges a social login identity provider's access for an Identity Cloud scial login token. To complete social login, you then need to exchange the social login token for an Identity Cloud access token by using the Complete social login operation.

Use this operation if you're implementing a solution that authenticates users directly with an identity provider, and without using a social login application.

Accepted Content-types

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

Authentication

No authentication is required to call this operation.

Base URL

The base URL for this operation is your application domain; for example:

https://educationcenter.rpxnow.com

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

Example requests

Example 1: Exchange a Facebook access token for a social login token

This command exchanges a sign-in token obtained from Facebook for an Identity Cloud social login token. The social login token can then be used for social registration and login calls by using Akamai's OAuth endpoints.

curl -X POST \
 'https://greg-stemp.rpxnow.com/signin/oauth_token' \
 -H 'Content-Type: application/json' \
 -d '{
   "provider":"facebook",
   "token": "EAAV6lsQIR0gBAItAtDeUZBbsFiHuTxhLaHLw9TqGDsXK6GQodDfgKXcCkxkZCZBxLKsxsWgV0iZATVAzx2RGlsOIFDIals3ZCblCEJn25pTj4Lk7XZCCEweKkHfHZBPP8B75dXc1BagGjNy8ZBpyObZB8FZCWSK0AAWevv15aEh85lTwZZDD"
  }'

Example response

If your API call succeeds the response includes the social login token:

{
  "stat":"ok",
  "token":"e96213b7bfddd1884b91544a11b5d5be52316590"
}

Example 2: Sign In with Apple

This command exchanges a sign-in token obtained from Sign In with Apple for an Identity Cloud social login token. Note that Sign In with Apple requires you to use the id_token parameter instead of the token parameter.

curl -X POST \
 'https://greg-stemp.rpxnow.com/signin/oauth_token' \
 -H 'Content-Type: application/json' \
 -d '{
   "provider":"apple",
   "id_token": "eyJraWQiOiJBSURPUEsxIiwiYWxnIjoiUlMyNTYifQ.eyJpc3MiOiJodHRwczovL2FwcIFDIals3ZCblCEJn25pTF90aW1lIjoxNTc5NzMyNzU2fQ.J-uEzGb36-o_kQNPuYz8Q_1GP0RGQpjebrmrDZlwA86n859LuXpUvIrDiwPzAHanilCFPergm769XU3xqmb6fHxAdzRNAge3fi5j5YY66N3yjpzGQ2L2B-NcGb56XEPGz"
  }'

Example response

If your API call succeeds the response includes the social login token:

{
  "stat":"ok",
  "token":"db2778db7b59a03d045b1707dd85ae6fc726eafb"
}

Parameters

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

ParameterTypeRequiredDescription
tokenstringAccess token from the social login identity provider.
providerstringName of the social login identity provider.
token-secretstringRequired only if using Twitter as the social login identity provider. The token secret is an additional authentication value Twitter returns following authentication.
id_tokenstringRequired only if using Sign In with Apple. Set the value of the id_token parameter to the value of the token returned from your Sign In with Apple app.