Keycloak is an Open Source Identity and Access Management solution for modern Applications and Services.
In this post, we will see how to install Keycloak using Docker and configure it to run our authentication service.
Install Keycloak
Make sure you have Docker installed before the next step.
From a terminal start Keycloak using the following command:
Bash
docker run -p 8080:8080 -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=password quay.io/keycloak/keycloak:16.1.0
This command will start Keycloak server on the local port 8080. It will also create an initial admin user with username admin
and password password
.
Configuring Keycloak
Visit the Keycloak Admin Console and login with the username and password we just created earlier.
http://localhost:8080/auth/admin
Let's go ahead and create our first realm.
-
Open the Keycloak Admin Console
-
Hover the mouse over the dropdown in the top-left corner where it says Master, then click on Add realm
-
Fill in the form with the following values:
- Name: myrealm
-
Click Create
A realm allows us to create isolated groups of applications and users. By
default there is a single realm in Keycloak called master
. This is dedicated
to manage Keycloak and should not be used for our own applications.
Then Wrap your App inside KeycloakProvider and pass the keycloak instance as prop
React (JS)
import React from 'react';
import { KeycloakProvider } from '@react-keycloak/web';
import keycloak from './keycloak';
// If you are using other providers (such as react-redux) it is recommended to place them inside KeycloakProvider.
const App = () => {
return (
<KeycloakProvider keycloak={keycloak}>
<div className="App">{/* place your router or application here */}</div>
</KeycloakProvider>
);
};
Conclusion
asdasasdas dasjd asjk dals dla s
- WebAssembly official website
- WebAssembly on MDN
- Emscripten official website
- Awesome WASM is a curated list of awesome things regarding WebAssembly (wasm) ecosystem.