Login Social
The login with social API allows users to authenticate themselves using their social media accounts, such as Facebook, Apple, Google, or Twitter.
Endpoint:
api/customer/auth/social
Http Method:
POST
You can obtain the credential keys required for social login from the Configuration API. For example, to use Facebook login, you'll need to obtain the Facebook App ID and App Secret from your Facebook Developer account and configure them in your application using the key provided by Supercommerce. Similarly, for Google and Apple login, you'll need to obtain the respective client IDs and secrets and configure them.
Configurations Keys:
FACEBOOK_CLIENT_ID
,FACEBOOK_CLIENT_SECRET
,GOOGLE_CLIENT_ID
,GOOGLE_CLIENT_SECRET
,GOOGLE_REDIRECT
,APPLE_CLIENT_ID
,APPLE_CLIENT_SECRET
,APPLE_REDIRECT_URI
.Request Body:
Key | Type | Required | Description |
---|---|---|---|
provider | string | Yes | The name of the social provider available (e.g., "facebook", "google", "apple") |
access_token | string | Yes | The access token obtained from the social provider. |
{
"provider": "google",
"access_token": "social-access-token"
}
- Success Response:
You can check more details about Customer Resource.
{
"code": 200,
"data": {
"id": 1153383,
"name": "Test",
"last_name": "Documentation",
"email": "doc2@supercommerce.io",
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..",
"is_guest": false,
//...
}
}
- Failure Response:
{
"code": 400,
"message": "Provider Error",
"errors": {
"errorMessage": "Invalid token",
//...
}
}
Check the following section to learn more about the Login Social API Reference
Social Register
If the user's phone number is null returned from Login Social, the API redirects the user to the complete profile with social register API.
Endpoint:
api/customer/auth/social_signup
Http Method:
POST
where they can provide their phone number and other required information. Once the user has completed their profile, the API generates a token for the user that can be used to access protected resources.
- Request Body:
Key | Type | Required | Description |
---|---|---|---|
name | string | Yes | The first name of the customer. |
last_name | string | Yes | The last name of the customer. |
email | string | Yes | The email address of the customer. |
phone | string | Yes | The phone number of the customer. |
password | string | Yes | The password of the customer. |
birthdate | string | Yes | The birthdays of the customer. |
token | string | Yes | The token obtained from the login social API. This token is used to authenticate the customer and link their social account with their registration. |
{
"name": "Test",
"last_name": "Documentation",
"email": "doc@supercommerce.io",
"phone": "01111111111",
"password": "12345678",
"birthdate": "2000-02-01",
"token": "social-login-token"
}
- Success Response:
You can check more details about Customer Resource.
{
"code": 200,
"data": {
//...
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..",
}
}
Check the following section to learn more about the Social Register API Reference