POST login/users/:user id/credentials/:provider

From Social ID Developers
(Difference between revisions)
Jump to: navigation, search
m
 
(2 intermediate revisions by one user not shown)
Line 34: Line 34:
 
| User ID Token.
 
| User ID Token.
 
|}
 
|}
<sup>1</sup> Required by OAuth 1.0 and OAuth 2.0 providers. It's optional for OIDC providers ("apple").
+
<sup>1</sup> Required by OAuth 1.0 and OAuth 2.0 providers (''facebook'', ''gplus'', ''linkedin'', ''twitter'', ''instagram''). It's optional for OIDC providers (''apple'').
  
 
<sup>2</sup> Required by OAuth 1.0 providers (''twitter''). Must not be informed for OAuth 2.0 and OIDC providers (''facebook'', ''gplus'', ''linkedin'', ''instagram'', ''apple'').
 
<sup>2</sup> Required by OAuth 1.0 providers (''twitter''). Must not be informed for OAuth 2.0 and OIDC providers (''facebook'', ''gplus'', ''linkedin'', ''instagram'', ''apple'').
Line 97: Line 97:
  
 
   curl -iX POST 'https://api.socialidnow.com/v1/marketing/login/users/3124/credentials/twitter' \
 
   curl -iX POST 'https://api.socialidnow.com/v1/marketing/login/users/3124/credentials/twitter' \
         -d '{”access_token”:”NGtqVcZ4K9XEQ142”,”access_secret”:”yXxeZn4gAdRru7TE”}\
+
         -d '{”access_token":"NGtqVcZ4K9XEQ142","access_secret":"yXxeZn4gAdRru7TE"}' \
 
         -H 'Content-type:application/json' \
 
         -H 'Content-type:application/json' \
 
         --user 136:O59wlcjPshfSY8iBwLJNpmyoj2mjHovgqy
 
         --user 136:O59wlcjPshfSY8iBwLJNpmyoj2mjHovgqy
Line 109: Line 109:
  
 
  {
 
  {
       "type”:”twitter”,
+
       "type":"twitter",
 
       "provider_id":"tGyqy7DJ9tGmBPEe",
 
       "provider_id":"tGyqy7DJ9tGmBPEe",
 
       "access_token":"NGtqVcZ4K9XEQ142",
 
       "access_token":"NGtqVcZ4K9XEQ142",
       “access_secret”:”yXxeZn4gAdRru7TE”,
+
       “access_secret":"yXxeZn4gAdRru7TE",
 
       "created_at":"2020-03-18T14:00:00Z",
 
       "created_at":"2020-03-18T14:00:00Z",
 
       "updated_at":"2020-03-18T14:00:00Z"
 
       "updated_at":"2020-03-18T14:00:00Z"
Line 121: Line 121:
 
==== Request ====
 
==== Request ====
  
   curl -iX POST 'https://api.socialidnow.com/v1/marketing/login/users/3124/credentials/facebook’ \
+
   curl -iX POST 'https://api.socialidnow.com/v1/marketing/login/users/3124/credentials/facebook' \
         -d '{”access_token”:”PvHKl2KsD1DMPvwsJflJlmMqB18HuLL5”}\
+
         -d '{"access_token":"PvHKl2KsD1DMPvwsJflJlmMqB18HuLL5"}' \
 
         -H 'Content-type:application/json' \
 
         -H 'Content-type:application/json' \
 
         --user 136:O59wlcjPshfSY8iBwLJNpmyoj2mjHovgqy
 
         --user 136:O59wlcjPshfSY8iBwLJNpmyoj2mjHovgqy
Line 134: Line 134:
  
 
  {
 
  {
       "type”:”facebook”,
+
       "type":"facebook",
 
       "provider_id":"0904093687399945",
 
       "provider_id":"0904093687399945",
 
       "access_token":"PvHKl2KsD1DMPvwsJflJlmMqB18HuLL5",
 
       "access_token":"PvHKl2KsD1DMPvwsJflJlmMqB18HuLL5",
Line 145: Line 145:
 
==== Request ====
 
==== Request ====
  
   curl -iX POST 'https://api.socialidnow.com/v1/marketing/login/users/3124/credentials/apple’ \
+
   curl -iX POST 'https://api.socialidnow.com/v1/marketing/login/users/3124/credentials/apple' \
         -d '{"id_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI5NjAyNDkzNTc2MzQ0NDIwIn0.cfuEkEl3hLxdjwUVQFSYZkU5BR_6JJTM0u60BRV8NnA”,”access_token”:”DHBK35O9JbbLcV7bfbnJQ8rScnEj1Tnt”}\
+
         -d '{"id_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI5NjAyNDkzNTc2MzQ0NDIwIn0.cfuEkEl3hLxdjwUVQFSYZkU5BR_6JJTM0u60BRV8NnA","access_token":"DHBK35O9JbbLcV7bfbnJQ8rScnEj1Tnt"}' \
 
         -H 'Content-type:application/json' \
 
         -H 'Content-type:application/json' \
 
         --user 136:O59wlcjPshfSY8iBwLJNpmyoj2mjHovgqy
 
         --user 136:O59wlcjPshfSY8iBwLJNpmyoj2mjHovgqy
Line 158: Line 158:
  
 
   {
 
   {
       "type”:”apple”,
+
       "type":"apple",
       "provider_id”:”9602493576344420”,
+
       "provider_id":"9602493576344420",
       "access_token”:”DHBK35O9JbbLcV7bfbnJQ8rScnEj1Tnt”,
+
       "access_token":"DHBK35O9JbbLcV7bfbnJQ8rScnEj1Tnt",
 
       "created_at":"2020-03-19T11:00:00Z",
 
       "created_at":"2020-03-19T11:00:00Z",
 
       "updated_at":"2020-03-19T11:00:00Z"
 
       "updated_at":"2020-03-19T11:00:00Z"
 
  }
 
  }

Latest revision as of 21:45, 21 May 2020

Contents

Description

Adds a Social App credential to a User.

Resource URL

  POST https://api.socialidnow.com/v1/marketing/login/users/:user_id/credentials/:provider

URL Parameters

user_id required User identifier.
provider required Social provider. Supported providers are: "facebook", "gplus", "linkedin", "twitter", "instagram" and "apple".

JSON Parameters

access_token required 1 User access token.
access_secret required 2 User access secret.
id_token required 3 User ID Token.

1 Required by OAuth 1.0 and OAuth 2.0 providers (facebook, gplus, linkedin, twitter, instagram). It's optional for OIDC providers (apple).

2 Required by OAuth 1.0 providers (twitter). Must not be informed for OAuth 2.0 and OIDC providers (facebook, gplus, linkedin, instagram, apple).

3 Required by OIDC providers (apple). Must not be informed for OAuth 1.0 and OAuth 2.0 providers (facebook, gplus, linkedin, twitter, instagram).

Authentication

This API requires Social Login App authentication. See Authentication.

Response

Response Status

created (201) Credential added to User.
unauthorized (401) The authentication is wrong. See Authentication.
forbidden (403) Invalid Credential.
not_found (404) The user was not found.
conflict (409) Credential is already connected to another user.
internal_server_error (500) An unknown error happened.

Response Body

type Credential Social App type, "facebook", "twitter", "linkedin", "gplus", "instagram" or "apple".
access_token Credential access token.
access_secret Credential access secret.
provider_id Credential provider identifier.
created_at Credential created timestamp.
updated_at Credential last updated timestamp.

Examples

Using OAuth 1.0 provider

Request

 curl -iX POST 'https://api.socialidnow.com/v1/marketing/login/users/3124/credentials/twitter' \
        -d '{”access_token":"NGtqVcZ4K9XEQ142","access_secret":"yXxeZn4gAdRru7TE"}' \
        -H 'Content-type:application/json' \
        --user 136:O59wlcjPshfSY8iBwLJNpmyoj2mjHovgqy

Response Headers

HTTP/1.1 201 Created
Status: 201

Response Body

{
     "type":"twitter",
     "provider_id":"tGyqy7DJ9tGmBPEe",
     "access_token":"NGtqVcZ4K9XEQ142",
     “access_secret":"yXxeZn4gAdRru7TE",
     "created_at":"2020-03-18T14:00:00Z",
     "updated_at":"2020-03-18T14:00:00Z"
}

Using OAuth 2.0 provider

Request

 curl -iX POST 'https://api.socialidnow.com/v1/marketing/login/users/3124/credentials/facebook' \
        -d '{"access_token":"PvHKl2KsD1DMPvwsJflJlmMqB18HuLL5"}' \
        -H 'Content-type:application/json' \
        --user 136:O59wlcjPshfSY8iBwLJNpmyoj2mjHovgqy

Response Headers

HTTP/1.1 201 Created
Status: 201

Response Body

{
     "type":"facebook",
     "provider_id":"0904093687399945",
     "access_token":"PvHKl2KsD1DMPvwsJflJlmMqB18HuLL5",
     "created_at":"2020-03-19T15:00:00Z",
     "updated_at":"2020-03-19T15:00:00Z"
}

Using OIDC provider

Request

 curl -iX POST 'https://api.socialidnow.com/v1/marketing/login/users/3124/credentials/apple' \
        -d '{"id_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI5NjAyNDkzNTc2MzQ0NDIwIn0.cfuEkEl3hLxdjwUVQFSYZkU5BR_6JJTM0u60BRV8NnA","access_token":"DHBK35O9JbbLcV7bfbnJQ8rScnEj1Tnt"}' \
        -H 'Content-type:application/json' \
        --user 136:O59wlcjPshfSY8iBwLJNpmyoj2mjHovgqy

Response Headers

HTTP/1.1 201 Created
Status: 201

Response Body

 {
     "type":"apple",
     "provider_id":"9602493576344420",
     "access_token":"DHBK35O9JbbLcV7bfbnJQ8rScnEj1Tnt",
     "created_at":"2020-03-19T11:00:00Z",
     "updated_at":"2020-03-19T11:00:00Z"
}
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox