Baidu Login with Web3Auth
note
Baidu login can be performed in various ways, depending on the use case. We have demonstrated this with Auth0, but this can be done with any other Federated/JWT providers.
Set up Baidu via Auth0
-
Create a verifier for your Auth0 application by selecting
Auth0
as the Login provider from this modal. -
Select the
Other
as the Authentication Type based on the dropdown. -
Enter the
Auth0 Client ID
andAuth0 Domain
from your Auth0 application. See how to create a new Auth0 application here. -
Add the Baidu Social Connection to your Auth0 application.
-
Click on the
Create
button to createBaidu
Custom Authentication via Auth0 verifier.
Example
import { OpenloginAdapter } from "@web3auth/openlogin-adapter";
// Create OpenloginAdapter instance once you have created Web3AuthNoModal instance
const openloginAdapter = new OpenloginAdapter({
adapterSettings: {
uxMode: "redirect",
loginConfig: {
jwt: {
verifier: "w3a-auth0-uk-demo", // Pass the Verifier name here
typeOfLogin: "jwt", // Pass on the login provider of the verifier you've created
clientId: "OfDAVldBEGslU9wjiWyQ1LPWOWNnnzim", // Pass on the Auth0 `Client ID` here
},
},
},
});
web3AuthNoModalInstance.configureAdapter(openloginAdapter);
// Initialize
await web3AuthNoModalInstance.init();
// Login with Baidu
await web3AuthNoModalInstance.connectTo(WALLET_ADAPTERS.OPENLOGIN, {
loginProvider: "jwt",
extraLoginOptions: {
domain: "https://web3auth.uk.auth0.com", // Pass on the Auth0 `Domain` here
verifierIdField: "sub", // Pass on the field name of the `sub` field in the JWT
connection: "baidu", // Use this to skip Auth0 Modal for Baidu login
},
});