End User Authentication and Authorization with OpenShift Service Mesh and Keycloak
I recently worked on a React project with Go backend using Gin web framework. Keycloak was the authentication mechanism for the front end; I also wanted to secure the back end using JSON Web Tokens, which Keycloak provided on every login. JWT verification setup in the Go application was easy.
First, copy the RS256 algorithm public key value from Keycloak.
Send the token as an Authorization header.
axios .get(BACKEND_URL.concat("sampleendpoint"), { headers: { Authorization: this.
This post will show you how to secure a React app using RedHat SSO (upstream Keycloak). In this case, OpenID-connect is my identity provider.
Install the official Keycloak js adapter
npm i keycloak-js --save Add host and port information to the client; in my case, it’s localhost:9000
In App.js, add a JavaScript object with the required configuration; you will find these configurations under Clients->Installation.
//keycloak init options const initOptions = { url: "https://localhost:8080/auth", realm: "test", clientId: "react-app", onLoad: "login-required" }; By default, to authenticate, you need to call the login function.