POST login/users/:user id/credentials/:provider
From Social ID Developers
(Difference between revisions)
Ivan.filho (Talk | contribs) (→Response) |
|||
(7 intermediate revisions by 3 users not shown) | |||
Line 22: | Line 22: | ||
{| | {| | ||
− | |||
− | |||
− | |||
− | |||
! align="left" width="200px" | access_token | ! align="left" width="200px" | access_token | ||
| width="200px" | required <sup>1</sup> | | width="200px" | required <sup>1</sup> | ||
Line 34: | Line 30: | ||
| User access secret. | | User access secret. | ||
|- | |- | ||
− | ! align="left" width="200px" | id_token | + | ! align="left" width="200px" | id_token |
| width="200px" | required <sup>3</sup> | | width="200px" | required <sup>3</sup> | ||
| 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 ( | + | <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 46: | Line 42: | ||
== Authentication == | == Authentication == | ||
− | This API requires | + | This API requires Login App authentication. See [[Authentication]]. |
== Response == | == Response == | ||
Line 64: | Line 60: | ||
! align="left" width="200px" | not_found (404) | ! align="left" width="200px" | not_found (404) | ||
| The user was not found. | | The user was not found. | ||
+ | |- | ||
+ | ! align="left" width="200px" | conflict (409) | ||
+ | | Credential is already connected to another user. | ||
|- | |- | ||
! align="left" width="200px" | internal_server_error (500) | ! align="left" width="200px" | internal_server_error (500) | ||
Line 98: | 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 '{ | + | -d '{”access_token":"NGtqVcZ4K9XEQ142","access_secret":"yXxeZn4gAdRru7TE"}' \ |
-H 'Content-type:application/json' \ | -H 'Content-type:application/json' \ | ||
--user 136:O59wlcjPshfSY8iBwLJNpmyoj2mjHovgqy | --user 136:O59wlcjPshfSY8iBwLJNpmyoj2mjHovgqy | ||
Line 110: | Line 109: | ||
{ | { | ||
− | " | + | "type":"twitter", |
"provider_id":"tGyqy7DJ9tGmBPEe", | "provider_id":"tGyqy7DJ9tGmBPEe", | ||
"access_token":"NGtqVcZ4K9XEQ142", | "access_token":"NGtqVcZ4K9XEQ142", | ||
− | + | “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 122: | Line 121: | ||
==== Request ==== | ==== Request ==== | ||
− | curl -iX POST 'https://api.socialidnow.com/v1/marketing/login/users/3124/credentials/ | + | curl -iX POST 'https://api.socialidnow.com/v1/marketing/login/users/3124/credentials/facebook' \ |
− | -d '{ | + | -d '{"access_token":"PvHKl2KsD1DMPvwsJflJlmMqB18HuLL5"}' \ |
-H 'Content-type:application/json' \ | -H 'Content-type:application/json' \ | ||
--user 136:O59wlcjPshfSY8iBwLJNpmyoj2mjHovgqy | --user 136:O59wlcjPshfSY8iBwLJNpmyoj2mjHovgqy | ||
Line 135: | Line 134: | ||
{ | { | ||
− | " | + | "type":"facebook", |
"provider_id":"0904093687399945", | "provider_id":"0904093687399945", | ||
"access_token":"PvHKl2KsD1DMPvwsJflJlmMqB18HuLL5", | "access_token":"PvHKl2KsD1DMPvwsJflJlmMqB18HuLL5", | ||
Line 146: | Line 145: | ||
==== Request ==== | ==== Request ==== | ||
− | curl -iX POST 'https://api.socialidnow.com/v1/marketing/login/users/3124/credentials/ | + | curl -iX POST 'https://api.socialidnow.com/v1/marketing/login/users/3124/credentials/apple' \ |
− | -d '{"id_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI5NjAyNDkzNTc2MzQ0NDIwIn0. | + | -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 159: | Line 158: | ||
{ | { | ||
− | " | + | "type":"apple", |
− | " | + | "provider_id":"9602493576344420", |
− | " | + | "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 16:52, 30 December 2021
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 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" }