After creating your app, the redirect url is set in the following position:
Add your Casdoor domain in the following position:
This part is very different from the actual situation in the documentation given by Baidu:
- 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 get
Client ID and
Client Secrets now!
Add a Baidu OAuth provider and fill the
Client ID and
Client Secrets in your Casdoor.
Now you can use Baidu as third party service to complete authentication!
If you encounter a Baidu prompt that 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 its documentation which shows the user name and the displayed name, so we can currently only use the masked name as the user name.