- Navigate to the
keycloak
directory and start Keycloak by runningdocker compose up
. - Open your browser and go to
http://localhost:8080
to access the Keycloak admin console. Log in using the admin credentials specified in the Docker Compose file. - Create a new realm by following these steps:
- Click on
master
in the sidebar. - Click the Create realm button.
- Enter a name for the new realm and save.
- Click on
- Go to the realm you created and click on Realm settings in the sidebar.
- Click on the Login tab and enable the following options:
- User registration
- Forgot password
- Email as username
- Login with email
- Verify Email
- Next, go to the Email tab and enter the information for:
- From
- From display name
- Host
- Port
- Enable SSL
- Toggle Authentication and enter your SMTP username and password.
- Inside the realm you just created, click on Clients in the sidebar and click on the Create client button.
- Set the Client Id, enable Client authentication, and set all of the following:
- Root URL:
http://localhost:3000/
- Home URL:
http://localhost:3000/
- Valid redirect URIs:
http://localhost:3000/*
- Valid post logout redirect URIs:
http://localhost:3000/*
- Web origins:
http://localhost:3000/*
- Root URL:
- Go to the Credentials tab and copy the Client Secret along with the Client Id you set before to the
.env
file in the CS Club website code.
- Click on Realm roles in the sidebar and create a new role called
restricted-access
. - Click on Users in the sidebar.
- Select the user you want and go to the Role mapping tab.
- Click on Filter by clients to switch to Filter by realm roles and click on
restricted-access
to assign the role.