POST /oauth/token provider credentials
From Social ID Developers
(Difference between revisions)
(Created page with "== Description == Generates a new user access token given an oauth token issued by an external provider. == Resource URL == POST https://api.socialidnow.com/v2/marketing...") |
|||
(15 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
== Description == | == Description == | ||
− | Generates a new | + | Generates a new Login User Token given an OAuth token issued by an external provider. |
== Resource URL == | == Resource URL == | ||
Line 18: | Line 18: | ||
! align="left" width="200px" | provider | ! align="left" width="200px" | provider | ||
| width="200px" | required | | width="200px" | required | ||
− | | external provider. Must be one of ''facebook'', ''gplus'', ''twitter'' | + | | external provider. Must be one of ''facebook'', ''gplus'', ''twitter'', ''linkedin'', ''instagram'' or ''apple''. |
|- | |- | ||
! align="left" width="200px" | access_token | ! align="left" width="200px" | access_token | ||
− | | width="200px" | required | + | | width="200px" | required <sup>1</sup> |
| provider access token. | | provider access token. | ||
|- | |- | ||
! align="left" width="200px" | access_secret | ! align="left" width="200px" | access_secret | ||
− | | width="200px" | required <sup> | + | | width="200px" | required <sup>2</sup> |
| provider access secret. | | provider access secret. | ||
+ | |- | ||
+ | ! align="left" width="200px" | id_token | ||
+ | | width="200px" | required <sup>3</sup> | ||
+ | | provider id token. | ||
|} | |} | ||
− | <sup>1</sup> Required by OAuth providers (''twitter'' and ''linkedin''). Must not be informed for | + | <sup>1</sup> Required by OAuth 1.0 and OAuth 2.0 providers. 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>3</sup> Required by OIDC providers (''apple''). Must not be informed for OAuth 1.0 and OAuth 2.0 providers (''facebook'', ''gplus'', ''linkedin'', ''twitter'', ''instagram''). | ||
== Authentication == | == Authentication == | ||
− | This API requires | + | This API requires Login App Client authentication. See [[Authentication]]. |
== Response == | == Response == | ||
Line 62: | Line 70: | ||
|- | |- | ||
| invalid_request | | invalid_request | ||
− | | A required parameter was not informed (grant_type, provider, access_token, access_secret); or the informed provider is invalid. | + | | A required parameter was not informed (grant_type, provider, access_token, access_secret, id_token); or the informed provider is invalid. |
|- | |- | ||
| unsupported_grant_type | | unsupported_grant_type | ||
Line 86: | Line 94: | ||
== Examples == | == Examples == | ||
− | === Using | + | === Using Facebook provider === |
==== Request ==== | ==== Request ==== | ||
curl -iX POST 'https://api.socialidnow.com/v2/marketing/oauth/token' \ | curl -iX POST 'https://api.socialidnow.com/v2/marketing/oauth/token' \ | ||
− | grant_type=provider_credentials&provider=facebook&access_token=CAACEdEose0cBAHiXP9CQDMsfo2AS8sfUhcw7UhrvWZBI8iOdWIv0nm33bva45lGYHknG13L4SVO9LqoSYJkKiFZBNBb07GUgjUFYb7SM6IwhQsil39gr9pc0Wq4ISK16Yy4YBosvRH1qr4bkYgBcYA4o06wYaxOe5HWC6XzHw3fB2z7Vm8WHmWUevf46G8tICvWtkeVTllnCo3wgCcTGswoYkwZD \ | + | -d grant_type=provider_credentials&provider=facebook&access_token=CAACEdEose0cBAHiXP9CQDMsfo2AS8sfUhcw7UhrvWZBI8iOdWIv0nm33bva45lGYHknG13L4SVO9LqoSYJkKiFZBNBb07GUgjUFYb7SM6IwhQsil39gr9pc0Wq4ISK16Yy4YBosvRH1qr4bkYgBcYA4o06wYaxOe5HWC6XzHw3fB2z7Vm8WHmWUevf46G8tICvWtkeVTllnCo3wgCcTGswoYkwZD \ |
--user 138:e8b9ca24f1b590af67e6271297d6e1f7226625d61c5b5daa1b2f215464e292cf | --user 138:e8b9ca24f1b590af67e6271297d6e1f7226625d61c5b5daa1b2f215464e292cf | ||
Line 106: | Line 114: | ||
"access_token": "6814cd360205e1245d2834ffab3c3c9103b71a5075a9cda4626b4d5cffbabb88", | "access_token": "6814cd360205e1245d2834ffab3c3c9103b71a5075a9cda4626b4d5cffbabb88", | ||
"expires_in": 604800, | "expires_in": 604800, | ||
− | "token_type": bearer, | + | "token_type": "bearer", |
"refresh_token": "17ef19c3e1b7499eaf849d59f220250210b5c44c10c71033d253de8b61b2a3ef", | "refresh_token": "17ef19c3e1b7499eaf849d59f220250210b5c44c10c71033d253de8b61b2a3ef", | ||
} | } | ||
− | === Using | + | === Using Twitter provider === |
+ | |||
+ | ==== Request ==== | ||
+ | |||
+ | curl -iX POST 'https://api.socialidnow.com/v2/marketing/oauth/token' \ | ||
+ | -d grant_type=provider_credentials&provider=twitter&access_token=18f6f37b-za1a-3c96-b771-a24d3f300aa2a&access_secret=9b2cf44a-1a28-4ddf-970e-4b2ff5223ff4 \ | ||
+ | --user 138:e8b9ca24f1b590af67e6271297d6e1f7226625d61c5b5daa1b2f215464e292cf | ||
+ | |||
+ | ==== Response ==== | ||
+ | |||
+ | ===== Response Headers ===== | ||
+ | |||
+ | HTTP/1.1 200 Ok | ||
+ | Status: 200 | ||
+ | |||
+ | ===== Response Body ===== | ||
+ | |||
+ | { | ||
+ | "access_token": "6814cd360205e1245d2834ffab3c3c9103b71a5075a9cda4626b4d5cffbabb88", | ||
+ | "expires_in": 604800, | ||
+ | "token_type": "bearer", | ||
+ | "refresh_token": "17ef19c3e1b7499eaf849d59f220250210b5c44c10c71033d253de8b61b2a3ef", | ||
+ | } | ||
+ | |||
+ | |||
+ | === Using Apple provider === | ||
==== Request ==== | ==== Request ==== | ||
curl -iX POST 'https://api.socialidnow.com/v2/marketing/oauth/token' \ | curl -iX POST 'https://api.socialidnow.com/v2/marketing/oauth/token' \ | ||
− | grant_type=provider_credentials&provider= | + | -d grant_type=provider_credentials&provider=apple&access_token=2956781498da545cb565aadffc6d47711780bfa464e4bb99dcff5f3d7f0c91c7&id_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJleGFtcGxlIn0.wqwdbCdHDEoknvUP-kyH2r5NrP4dVdeGeYpEz77MGtc \ |
--user 138:e8b9ca24f1b590af67e6271297d6e1f7226625d61c5b5daa1b2f215464e292cf | --user 138:e8b9ca24f1b590af67e6271297d6e1f7226625d61c5b5daa1b2f215464e292cf | ||
Line 130: | Line 163: | ||
"access_token": "6814cd360205e1245d2834ffab3c3c9103b71a5075a9cda4626b4d5cffbabb88", | "access_token": "6814cd360205e1245d2834ffab3c3c9103b71a5075a9cda4626b4d5cffbabb88", | ||
"expires_in": 604800, | "expires_in": 604800, | ||
− | "token_type": bearer, | + | "token_type": "bearer", |
"refresh_token": "17ef19c3e1b7499eaf849d59f220250210b5c44c10c71033d253de8b61b2a3ef", | "refresh_token": "17ef19c3e1b7499eaf849d59f220250210b5c44c10c71033d253de8b61b2a3ef", | ||
} | } |
Latest revision as of 16:57, 30 December 2021
Contents |
Description
Generates a new Login User Token given an OAuth token issued by an external provider.
Resource URL
POST https://api.socialidnow.com/v2/marketing/oauth/token
Parameters
Form Url Encoded Parameters
grant_type | required | grant_type. Must be set to provider_credentials. |
---|---|---|
provider | required | external provider. Must be one of facebook, gplus, twitter, linkedin, instagram or apple. |
access_token | required 1 | provider access token. |
access_secret | required 2 | provider access secret. |
id_token | required 3 | provider id token. |
1 Required by OAuth 1.0 and OAuth 2.0 providers. 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 Client authentication. See Authentication.
Response
Response Status
ok (200) | The access token was generated successfully |
---|---|
bad_request (400) | Some required parameter was not informed. |
unauthorized (401) | The authentication is wrong. See Authentication. |
internal_server_error (500) | An unknown error happened. |
In case of error, one of of the following codes will be set in the JSON response. An error description will also be set accordingly.
Code | Description |
---|---|
invalid_client | The request authentication is invalid (not given or combination do not match); or the client authentication is invalid. |
invalid_request | A required parameter was not informed (grant_type, provider, access_token, access_secret, id_token); or the informed provider is invalid. |
unsupported_grant_type | The informed grant type is not supported. |
Response Body
access_token | The generated access token. |
---|---|
expires_in | Expiration in seconds. |
token_type | The token_type. Will be set to bearer. |
refresh_token | The refresh_token to retrieve a new access token after expiration. |
Examples
Using Facebook provider
Request
curl -iX POST 'https://api.socialidnow.com/v2/marketing/oauth/token' \ -d grant_type=provider_credentials&provider=facebook&access_token=CAACEdEose0cBAHiXP9CQDMsfo2AS8sfUhcw7UhrvWZBI8iOdWIv0nm33bva45lGYHknG13L4SVO9LqoSYJkKiFZBNBb07GUgjUFYb7SM6IwhQsil39gr9pc0Wq4ISK16Yy4YBosvRH1qr4bkYgBcYA4o06wYaxOe5HWC6XzHw3fB2z7Vm8WHmWUevf46G8tICvWtkeVTllnCo3wgCcTGswoYkwZD \ --user 138:e8b9ca24f1b590af67e6271297d6e1f7226625d61c5b5daa1b2f215464e292cf
Response
Response Headers
HTTP/1.1 200 Ok Status: 200
Response Body
{ "access_token": "6814cd360205e1245d2834ffab3c3c9103b71a5075a9cda4626b4d5cffbabb88", "expires_in": 604800, "token_type": "bearer", "refresh_token": "17ef19c3e1b7499eaf849d59f220250210b5c44c10c71033d253de8b61b2a3ef", }
Using Twitter provider
Request
curl -iX POST 'https://api.socialidnow.com/v2/marketing/oauth/token' \ -d grant_type=provider_credentials&provider=twitter&access_token=18f6f37b-za1a-3c96-b771-a24d3f300aa2a&access_secret=9b2cf44a-1a28-4ddf-970e-4b2ff5223ff4 \ --user 138:e8b9ca24f1b590af67e6271297d6e1f7226625d61c5b5daa1b2f215464e292cf
Response
Response Headers
HTTP/1.1 200 Ok Status: 200
Response Body
{ "access_token": "6814cd360205e1245d2834ffab3c3c9103b71a5075a9cda4626b4d5cffbabb88", "expires_in": 604800, "token_type": "bearer", "refresh_token": "17ef19c3e1b7499eaf849d59f220250210b5c44c10c71033d253de8b61b2a3ef", }
Using Apple provider
Request
curl -iX POST 'https://api.socialidnow.com/v2/marketing/oauth/token' \ -d grant_type=provider_credentials&provider=apple&access_token=2956781498da545cb565aadffc6d47711780bfa464e4bb99dcff5f3d7f0c91c7&id_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJleGFtcGxlIn0.wqwdbCdHDEoknvUP-kyH2r5NrP4dVdeGeYpEz77MGtc \ --user 138:e8b9ca24f1b590af67e6271297d6e1f7226625d61c5b5daa1b2f215464e292cf
Response
Response Headers
HTTP/1.1 200 Ok Status: 200
Response Body
{ "access_token": "6814cd360205e1245d2834ffab3c3c9103b71a5075a9cda4626b4d5cffbabb88", "expires_in": 604800, "token_type": "bearer", "refresh_token": "17ef19c3e1b7499eaf849d59f220250210b5c44c10c71033d253de8b61b2a3ef", }