🕓 10 minutes
What you’ll learn
How to create a new instance of the Keycloak as a managed service in the CodeNow and how to setup its basics.
- Choose the Get New Services in the Marketplace menu.
- Add selected service Keycloak.
- Type new instance service name, choose the box and environment for deployment, and confirm it.
- Wait for request processing and see the details of the new Keycloak instance.
- Open Keycloak admin panel, use admin credentials provided under your service details to log in.
- Use the admin panel link and generated credentials for sign in to Keycloak admin console .
Keycloak basics setup
Create a new realm by clicking at "Add realm" button. It appears in popup menu at the top of left navigation pane. Confirm and leave it with defaults. Note: think of realm as a "security domain" for your future applications.
Click "Clients" and create a new client. The term "client" here refers to our application, so name it accordingly (for example: api). After creation, fill in mandatory field "Valid Redirect URIs" (you can enter any value, we will not be using it in this tutorial). Leave other settings to defaults and save your changes.
Add new role in menu "Roles / Add Role", name it for example "api-role".
Navigate to "Users / Add User" and create a new user, name it for example "api-user". Now go to "Credentials" tab and enter a new password, uncheck "Temporary" switch and click "Set Password". Next, select "Role Mappings" and assign our role (api-role) to this user.
Last thing we need to do is to write down our authorization endpoint. We will need it later in our application. It is composed of the base URL of your Keycloak instance + "/auth". For example https://mfr-keycloak-keycloak.box.codenow-dev.codenow.com/auth
We are done with basic Keycloak setup. For more information see Keycloak official site.
Maybe you will be interested in our other tutorials: