react-keycloak | React/React Native/NextJS/Razzle components for Keycloak | Frontend Framework library
kandi X-RAY | react-keycloak Summary
kandi X-RAY | react-keycloak Summary
React bindings for Keycloak.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of react-keycloak
react-keycloak Key Features
react-keycloak Examples and Code Snippets
Community Discussions
Trending Discussions on react-keycloak
QUESTION
I'm trying to use a request inteceptor with react-keycloak/web - however i get an array of errors when doing so.
...ANSWER
Answered 2021-Nov-07 at 11:37You can't use react hooks out of react tree.
You can export axoios instance and import it elsewhere inside react (eg: App.js) and set interceptors there.
for example:
QUESTION
I'd like to do the authentication for my nextjs frontend via a keycloak server. I've found this great example about how to do it. Unfortunately the example is written in typescript and I am trying to adjust it so that I can use it in my application written in javascript. Since I don't know much about TS I couldn't figure out how to transform the following two TS statements, so that they run in JS:
...ANSWER
Answered 2021-May-04 at 15:54In plain js/React, it will be like this
QUESTION
I am using Gatsby to build static site and keycloak for auth.
I am using these libs: keycloak-js
and @react-keycloak/web
During development (gatsby develop) everything runs fine, auth works and all that...
But when i run gatsby build
, it fails specifically with this error:
WebpackError: authClient has not been assigned to ReactKeycloakProvider
This is the react keycloak lib that i am using @react-keycloak/web and error comes from useKeycloak.ts
file.
ANSWER
Answered 2021-Mar-09 at 18:43Have you tried loadable-components
? It seems a matter of SSR...
QUESTION
I'm attempting to integrate this package into an app using this example. I'm not too familiar with typescript and I see that it uses interface
in one of the utils (which javascript does not have). I've read Does JavaScript have the interface type (such as Java's 'interface')?, but I'm not sure this is the same as the one typescript uses.
Here's the TS code I am trying to convert:
...ANSWER
Answered 2021-Mar-12 at 06:56React Router takes a prop component
with a lowercase c
. In order to call a custom component using JSX it must have an uppercase name. See the docs
The Typescript example code renamed the prop component
to Component
when destructuring it. That allows them to call using JSX.
When converting the code to Javascript you accidentally removed this renaming. You probably mistook it for a type annotation.
This code should work:
QUESTION
So I've just created a new React project where I use the official keycloak-js adapter with the react-keycloak/web dependency for react bindings. I have followed all the "official" ways of doing things and I have this:
keycloak.js (config):
...ANSWER
Answered 2021-Feb-26 at 22:09Silly me, the problem was a mismatch between the keycloak server I used and the version of react-keycloak and keycloak-js
QUESTION
i'm trying to authenticate in keycloak in nextjs using @react-keycloak/nextjs but once i pass the login it keep sending me back to keycloak server and returning to the main page until it gives me an error because my token key is expired. This is my _app.js:
...ANSWER
Answered 2021-Jan-18 at 14:35React-keycloak/nextjs is deprecated in favor of react-keycloak/ssr. I followed the examples here: https://www.npmjs.com/package/@react-keycloak/ssr and was able to fully authenticate without issue.
I'm not sure what is causing your looping issues but it doesn't look like you are using the required cookie parser or passing them into the props via getInitialProps so that may be a good place to start.
QUESTION
The axios instance is not yet ready upon render as I get the error "Cannot read property 'get' of undefined", BUT the branches are loaded, so apparently next attempt succeeds.
The axios instance in hooks.js
:
ANSWER
Answered 2021-Jan-11 at 08:16You need to make it wait till axiosInstance
is defined, e.g. as follows:
QUESTION
In my React app, I am using keycloak and the KeycloakProvider from the "react-keycloak/web" library.
Certain routes are protected using a PrivateRoute component that pulls the keycloak state using the useKeycloak()
hook and checking the user is authorised and has the correct roles:
ANSWER
Answered 2020-Aug-30 at 21:59I managed to work around it by mocking the hook itself. It's not quite as clean as I would have liked, but works well enough for now.
QUESTION
I'm using simple React application with Keycloak for authentication mechanism (login/logout page + OpenID authorization). I have deployed Keycloak instance to Amazon EC2, and can access admin console. Everything is configured correctly in admin console. I created separate Client with access type Public.
For front end, I'm using this library (https://www.npmjs.com/package/@react-keycloak/web). Everything is according to documentation and example (https://github.com/react-keycloak/react-keycloak-examples/tree/master/examples/react-router).
But when my Keycloak instance is initializing, I don't see any redirections to keycloak's login page. And also, I see in network tab, that step1.html returned 404 Not Found. Request url is correct.
Maybe anyone faced with this issue?
...ANSWER
Answered 2020-Oct-15 at 03:42After investigation, I found that server version was 8.0.2, while version of keycloak-js was 11. I just downgraded keycloak-js library to 9.0.2, and everything was fixed.
QUESTION
I'm having issues trying to integrate Keycloak with a Gatsby static website. The purpose of the integration is letting logged users interact with components in the website (features such as: Like, Share, etc.), while the website is completely public.
The Keycloak instance is on a remote server, with the realm set-up and the client added with this configuration.
I'm using this repo as reference, but I guess there are some differences because of the modules version. I'm using:
...ANSWER
Answered 2020-Aug-26 at 13:52It seems that the latest keycloak-js
version is not compatible with older Keycloak servers. Try downgrading keycloak-js
as suggested here. Version 10.0.2
did the trick for me.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install react-keycloak
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page