Facebook Sign Up/Log In
Users can log in/register the system through their Facebook account
API Usage Instructions
Before calling the API, please ensure you have thoroughly read the relevant API documentation. Below are specific instructions for different login methods:
一、Setting Up Facebook Login Configuration
For more detailed steps, please refer to the Facebook developer documentation: Facebook Developer Documentation
Before using the Facebook JavaScript SDK, you need to register as a Facebook developer and create an application. The specific steps are as follows:
Visit the Facebook Developer Platform: Log in to the Facebook Developer Platform using your Facebook account.
Create a New App: Go to the "My Apps" page, click the "Create App" button, enter the app name and contact email, and select the app category.
Obtain the App ID and App Secret: After successful creation, go to the "Settings" page to get the Client ID (Client ID) and Client Secret (Client Secret).
Configure Allowed Domains for JavaScript SDK: Add the current page domain to the "Allowed Domains for JavaScript SDK" (local domains cannot be configured).
Enable "Login with JavaScript SDK": Turn on the configuration switch for "Login with JavaScript SDK."
Configure the Client ID and Client Secret in the White Label Management Backend.
二、Retrieve Third-Party Login Configuration Information
Call the third-party configuration API to obtain the ClientId registered in the first step.
Request Parameters:
Response Structure:
三、Login Code Implementation
1.Import the Facebook JavaScript SDK:
Include the Facebook JavaScript SDK in your HTML page using the following method:
Replace appId with the clientId returned from the third-party login configuration API.
2. Initiate Login Authorization and Obtain Access Token
After importing the Facebook JavaScript SDK, implement user login and access token retrieval as follows: Call the FB.login() method: Use this method in an interactive scenario to allow users to log in with their Facebook account and authorize.
Handle user login status: In the callback function, check the login status. If the login is successful, retrieve the access token and proceed with further actions.
Complete Implementation Code Example:
3. Facebook Access Token Verification: Call the Facebook third-party login verification API.
Request Parameters:
Response Structure:
4. Complete Login/Register: Based on the information returned in the previous step, call the third-party login or registration API.
Last updated