Before the integration, we need to deploy Casdoor locally.
Then, we can quickly implement a Casdoor-based login page in our own app by following these steps.
Step 1: Configure Casdoor application
- Create a new Casdoor application or use an existing one.
- Add a redirect URL:
- Copy the client ID and client secret. We will need them in the following steps.
Step 2: Add a user in Casdoor
Now that you have the application, you need to create a user and assign a role.
Go to the "Users" page and click on "Add user" in the top right corner. This will open a new page where you can add the new user.
Save the user after adding a username and selecting the organization "Thingsboard" (other details are optional).
Next, you need to set up a password for the user. You can do this by clicking on "Manage your password".
Choose a password for the user and confirm it.
Step 3: Prerequisites and Build Thingsboard App
First of all, Thingsboard only supports Java 11 (OpenJDK).
You can download it from the following link:
To start Thingsboard, follow these steps (for Windows system):
- Download and extract the package. Download the package
- Configure Thingsboard in \thingsboard\conf\thingsboard.yml according to your preferences, including the configuration of Kafka, PostgreSQL, and others.
install.bat –loadDemoin the command line in the Thingsboard folder to install and add demo data.
net start thingsboardin the command line to start Thingsboard. You should see the following output:
Step 4: Integrate Casdoor
Now open http://localhost:8080/ and log in to the admin account:
Account: firstname.lastname@example.org / Password: sysadmin
After successfully logging in, click the OAuth2 button at the bottom left of the page.
Fill in the blanks as follows:
You can get these values from the following link: OIDC discovery URL
After filling in these blanks, you have successfully integrated Casdoor with Thingsboard. When you log in to http://localhost:8080/, you should see the following: