Baidu signs users in with their Baidu account — one of the broadest consumer identities in mainland China.
Copy the redirect URI
In the Authdog console, select the project and environment, open Authentication > Providers, find Baidu, and click Enable. Copy the redirect URI shown in the form:
https://identity.authdog.com/api/v1/callback/<connectionId>Create the application
- Open the Baidu developer console and register an application.
- Set the authorization callback to the redirect URI from Authdog.
- Copy the API Key and Secret Key.
Configure Authdog
| Field | Value |
|---|---|
| Client ID | The Baidu API Key |
| Client Secret | The Baidu Secret Key |
Save, then toggle the connection active.
What Baidu returns
Authdog requests the basic scope and reads the profile from https://openapi.baidu.com/rest/2.0/passport/users/getInfo.
The passport endpoint returns the user id, username, and portrait. No email address is released at the basic scope.
This connector does not return an email address, so users who arrive through it have a display name and an identifier only. Pair it with a method that collects one, or ask for an email after the first sign-in.
Test it
- Open your environment's hosted sign-in page, or link to
https://identity.authdog.com/api/v1/signin/<connectionId>. - Select the Baidu button and complete the flow.
- Confirm the user appears under Users in the console with a Baidu identity linked.
Troubleshooting
| Symptom | Cause |
|---|---|
redirect_uri_mismatch |
The callback registered on the app differs |
| Redirect or callback URL error | The URI registered with the provider does not match Authdog's exactly |
| Works in one environment only | Each environment has its own connectionId, and so its own redirect URI to register |
Related
| Read | To learn how to |
|---|---|
| Connectors | Set up any other social provider |