انتقل إلى المحتوى الرئيسي

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:

KeyTypeRequiredDescription
providerstringYesThe name of the social provider available (e.g., "facebook", "google", "apple")
access_tokenstringYesThe access token obtained from the social provider.
{
"provider": "google",
"access_token": "social-access-token"
}
  • Success Response:
Customer Resource

You can check more details about Customer Resource.

200 OK - If the login is successful
{
"code": 200,
"data": {
"id": 1153383,
"name": "Test",
"last_name": "Documentation",
"email": "doc2@supercommerce.io",
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..",
"is_guest": false,
//...
}
}
  • Failure Response:
400 ERROR - Provider Error with message Invalid token
{
"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:
KeyTypeRequiredDescription
namestringYesThe first name of the customer.
last_namestringYesThe last name of the customer.
emailstringYesThe email address of the customer.
phonestringYesThe phone number of the customer.
passwordstringYesThe password of the customer.
birthdatestringYesThe birthdays of the customer.
tokenstringYesThe 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:
Customer Resource

You can check more details about Customer Resource.

200 OK - If the response is successful
{
"code": 200,
"data": {
//...
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..",
}
}
معلومات

Check the following section to learn more about the Social Register API Reference