After creating your app, the redirect URL should be set in the following position:
Add your Casdoor domain in the following position:
This part is very different from the information provided in the Baidu documentation:
- Adding the URL to the callback URL setting will most likely fail to validate the URL and cause the login to fail, so we add our domain name to the domain setting.
- Only one URL or domain name can be added, which is very different from the documentation.
Then you can obtain the
Client ID and
Add a Baidu OAuth provider and fill in the
Client ID and
Client Secrets in your Casdoor.
Now you can use Baidu as a third-party service to complete authentication!
If you encounter a Baidu prompt that states your redirect URL is incorrect, here are some ways you might be able to fix it:
- Add your domain name to the appropriate location and then reset the Secret (Baidu reset Secret has a bug, it will prompt you an error, but after refreshing the page the Secret has been refreshed).
- If the above methods do not solve the problem, we suggest you delete the application and create a new one, and set your domain name first.
Another problem is that the user name returned by Baidu is masked, unlike their documentation which shows the user name and displayed name. Therefore, we can currently only use the masked name as the user name.