POST login/apps/:app id/sign ins/:provider
Ivan.filho (Talk | contribs) (Sign Ins Provider) |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 3: | Line 3: | ||
Creates a new sign_in given a provider credential. | Creates a new sign_in given a provider credential. | ||
− | Use this API when you already have your own authentication | + | Use this API when you already have your own authentication mechanism for the given provider. With this API you can keep on using all Social Login APIs and plugins and populating your Database with new users. |
Important: if you use the user token in any Javascript API you will have to get a the new one generated by this operation using [[GET login/users/:user_id]]. See [[Social Login Tokens]] for more details. | Important: if you use the user token in any Javascript API you will have to get a the new one generated by this operation using [[GET login/users/:user_id]]. See [[Social Login Tokens]] for more details. | ||
Line 18: | Line 18: | ||
! align="left" width="200px" | app_id | ! align="left" width="200px" | app_id | ||
| width="200px" | required | | width="200px" | required | ||
− | | | + | | Login App identifier. |
|- | |- | ||
! align="left" width="200px" | provider | ! align="left" width="200px" | provider | ||
Line 48: | Line 48: | ||
== Authentication == | == Authentication == | ||
− | This API requires | + | This API requires Account authentication. See [[Authentication]]. |
== Response == | == Response == | ||
Line 56: | Line 56: | ||
== Examples == | == Examples == | ||
− | === | + | === Using OAuth 1.0 provider === |
− | + | ==== Request ==== | |
curl -iX POST 'https://api.socialidnow.com/v1/marketing/login/apps/:app_id/sign_ins/twitter' \ | curl -iX POST 'https://api.socialidnow.com/v1/marketing/login/apps/:app_id/sign_ins/twitter' \ | ||
Line 65: | Line 65: | ||
--user <api_id>:<api_secret> | --user <api_id>:<api_secret> | ||
− | + | ==== Response Headers ==== | |
+ | |||
+ | HTTP/1.1 201 Created | ||
+ | Location: https://api.socialidnow.com/v1/marketing/login/sign_ins/5559 | ||
+ | Status: 201 | ||
+ | |||
+ | ==== Response Body ==== | ||
+ | |||
+ | { | ||
+ | "connection":"https://api.socialidnow.com/v1/marketing/login/connections/a4b4cee9c05774d8b6e2427818f8e7866363eff0ea6c69edec8ac32dd0b71452", | ||
+ | "connection_id":"a4b4cee9c05774d8b6e2427818f8e7866363eff0ea6c69edec8ac32dd0b71452", | ||
+ | "login_token":"184cbcf30260b81d061e1f3903bf372089b48c7f5c1fd90649e14b6f17ed6a56", | ||
+ | "user_id":340 | ||
+ | } | ||
+ | |||
+ | === Using OAuth 2.0 provider === | ||
+ | |||
+ | ==== Request ==== | ||
curl -iX POST 'https://api.socialidnow.com/v1/marketing/login/apps/:app_id/sign_ins/facebook' \ | curl -iX POST 'https://api.socialidnow.com/v1/marketing/login/apps/:app_id/sign_ins/facebook' \ | ||
Line 72: | Line 89: | ||
--user <api_id>:<api_secret> | --user <api_id>:<api_secret> | ||
− | + | ==== Response Headers ==== | |
+ | |||
+ | HTTP/1.1 201 Created | ||
+ | Location: https://api.socialidnow.com/v1/marketing/login/sign_ins/4742 | ||
+ | Status: 201 | ||
+ | |||
+ | ==== Response Body ==== | ||
+ | |||
+ | { | ||
+ | "connection":"https://api.socialidnow.com/v1/marketing/login/connections/a4b4cee9c05774d8b6e2427818f8e7866363eff0ea6c69edec8ac32dd0b71452", | ||
+ | "connection_id":"8277935dad4bab116d30127d029395f649a0be6d4a81e0fa6e75340c5836cef5", | ||
+ | "login_token":"63cdde2de0583b4228bcb81c6bf18c0defda1f37e21c132425e08340ca918ee0", | ||
+ | "user_id":340 | ||
+ | } | ||
+ | |||
+ | === Using OIDC provider === | ||
+ | |||
+ | ==== Request ==== | ||
curl -iX POST 'https://api.socialidnow.com/v1/marketing/login/apps/:app_id/sign_ins/apple' \ | curl -iX POST 'https://api.socialidnow.com/v1/marketing/login/apps/:app_id/sign_ins/apple' \ | ||
Line 78: | Line 112: | ||
-H 'Content-type:application/json' \ | -H 'Content-type:application/json' \ | ||
--user <api_id>:<api_secret> | --user <api_id>:<api_secret> | ||
− | |||
− | |||
==== Response Headers ==== | ==== Response Headers ==== | ||
HTTP/1.1 201 Created | HTTP/1.1 201 Created | ||
− | Location: https://api.socialidnow.com/v1/marketing/login/sign_ins/ | + | Location: https://api.socialidnow.com/v1/marketing/login/sign_ins/6271 |
Status: 201 | Status: 201 | ||
Line 91: | Line 123: | ||
{ | { | ||
"connection":"https://api.socialidnow.com/v1/marketing/login/connections/a4b4cee9c05774d8b6e2427818f8e7866363eff0ea6c69edec8ac32dd0b71452", | "connection":"https://api.socialidnow.com/v1/marketing/login/connections/a4b4cee9c05774d8b6e2427818f8e7866363eff0ea6c69edec8ac32dd0b71452", | ||
− | "connection_id":" | + | "connection_id":"161e41dbd1a23fcbf8cdffa46ea7d2cddecd10b022ce30eba491a7713ba5054e", |
− | "login_token":" | + | "login_token":"48573dd5c0d5ee02a2e7e0c681376eca914d309e7213f86f893a4a84d1b756dc", |
"user_id":340 | "user_id":340 | ||
} | } |
Latest revision as of 16:58, 30 December 2021
Contents |
Description
Creates a new sign_in given a provider credential.
Use this API when you already have your own authentication mechanism for the given provider. With this API you can keep on using all Social Login APIs and plugins and populating your Database with new users.
Important: if you use the user token in any Javascript API you will have to get a the new one generated by this operation using GET login/users/:user_id. See Social Login Tokens for more details.
Resource URL
POST https://api.socialidnow.com/v1/marketing/login/apps/:app_id/sign_ins/:provider
Parameters
URL Parameters
app_id | required | Login App 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. 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 Account authentication. See Authentication.
Response
Same as GET login/sign_ins/:id.
Examples
Using OAuth 1.0 provider
Request
curl -iX POST 'https://api.socialidnow.com/v1/marketing/login/apps/:app_id/sign_ins/twitter' \ -d '{"access_token":"<access_token>","access_secret":"<access_secret>"}' \ -H 'Content-type:application/json' \ --user <api_id>:<api_secret>
Response Headers
HTTP/1.1 201 Created Location: https://api.socialidnow.com/v1/marketing/login/sign_ins/5559 Status: 201
Response Body
{ "connection":"https://api.socialidnow.com/v1/marketing/login/connections/a4b4cee9c05774d8b6e2427818f8e7866363eff0ea6c69edec8ac32dd0b71452", "connection_id":"a4b4cee9c05774d8b6e2427818f8e7866363eff0ea6c69edec8ac32dd0b71452", "login_token":"184cbcf30260b81d061e1f3903bf372089b48c7f5c1fd90649e14b6f17ed6a56", "user_id":340 }
Using OAuth 2.0 provider
Request
curl -iX POST 'https://api.socialidnow.com/v1/marketing/login/apps/:app_id/sign_ins/facebook' \ -d '{"access_token":"<access_token>"}' \ -H 'Content-type:application/json' \ --user <api_id>:<api_secret>
Response Headers
HTTP/1.1 201 Created Location: https://api.socialidnow.com/v1/marketing/login/sign_ins/4742 Status: 201
Response Body
{ "connection":"https://api.socialidnow.com/v1/marketing/login/connections/a4b4cee9c05774d8b6e2427818f8e7866363eff0ea6c69edec8ac32dd0b71452", "connection_id":"8277935dad4bab116d30127d029395f649a0be6d4a81e0fa6e75340c5836cef5", "login_token":"63cdde2de0583b4228bcb81c6bf18c0defda1f37e21c132425e08340ca918ee0", "user_id":340 }
Using OIDC provider
Request
curl -iX POST 'https://api.socialidnow.com/v1/marketing/login/apps/:app_id/sign_ins/apple' \ -d '{"id_token":"<id_token>"}' \ -H 'Content-type:application/json' \ --user <api_id>:<api_secret>
Response Headers
HTTP/1.1 201 Created Location: https://api.socialidnow.com/v1/marketing/login/sign_ins/6271 Status: 201
Response Body
{ "connection":"https://api.socialidnow.com/v1/marketing/login/connections/a4b4cee9c05774d8b6e2427818f8e7866363eff0ea6c69edec8ac32dd0b71452", "connection_id":"161e41dbd1a23fcbf8cdffa46ea7d2cddecd10b022ce30eba491a7713ba5054e", "login_token":"48573dd5c0d5ee02a2e7e0c681376eca914d309e7213f86f893a4a84d1b756dc", "user_id":340 }