# Use JavaScript SDK
This method is suitable for scenarios where you implement the login interface yourself.
For example, to use GitHub social login, you only need to implement the following lines of code:
You can view the unique identifier corresponding to each social login here: Supported Social Login List.
import {AuthenticationClient} from "authing-js-sdk"
const authenticationClient = new AuthenticationClient({
appId: "YOUR_APP_ID",
})
// Login with GitHub
await authenticationClient.social.authorize("github", {
onSuccess: (user) => {console.log(user) },
onError: (code, message) => {},
})
-Initialize AuthenticationClient
through App ID, you can get the app ID in the following ways:
-Call the authenticationClient.social.authorize
method, the first parameter is passed to github
, the second parameter specifies the onSuccess
and onError
callback functions.
-After the user successfully logs in, you can get the user information in the onSuccess
callback function; if the login fails, you can get the error code and error information in the onError
callback function. For complete error codes, please see: error code list.
# Next
After obtaining the user information, you can get the login credential token. You can carry this token in subsequent API requests, and then distinguish different users based on this token in the backend interface. For details, see [Verification token](../ ../advanced/verify-jwt-token.md#yan-zheng-authing-qian-fa-de-token).