question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

keycloak object properties such as keycloak.authenticated are not reactive

See original GitHub issue

When I use e.g. keycloak.authenticated (keycloak gotten from the hook), things will not rerender even if authenticated gets a new value. (as far as I can tell?)

I was thinking I could maybe solve this in my project by maybe sort of creating a useState alternative for authenticated, that somehow refreshes itself whenever the provider’s onEvent callback runs. But I think this should probably be something that’s built into react-keycloak since it will be a common problem/usecase.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
jsphstlscommented, Sep 17, 2021

I’m glad I found this thread, I thought for sure that the hook would cause a re-render. React docs advise not to prevent re-renders especially when it comes to hooks since one of the strengths of React is that multiple re-renders can still produce a single update to the DOM.

Instead of changing the behaviour of a hook, an alternate hook could be provided with a different name.

3reactions
Powersourcecommented, Nov 2, 2020

PS. probably a good idea to mention in the readme that if people just want auth then they could probably use any OIDC compatible client

Read more comments on GitHub >

github_iconTop Results From Across the Web

Keycloak object property "authenticated" returns false when ...
However, once successfully logged in, I am being redirected to localhost:3000/welcome (which is good), but without any content (which is not ...
Read more >
Securing Applications and Services Guide - Keycloak
The first is an application that asks the Keycloak server to authenticate a user for them. After a successful login, the application will...
Read more >
Reactive Spring Security 5 Hands-On Workshop
It is fully non-blocking, supports Reactive Streams back pressure, ... Determines if an authenticated user has access to a specific object.
Read more >
Fine-grained Authorization Services in Keycloak with Spring ...
As we know, Keycloak is the Identity and Access Management solution that provides out-of-the-box authentication and authorization services.
Read more >
Spring Security 5 - OAuth2 Login - Baeldung
Learn how to authenticate users with Facebook, Google or other ... Adding these properties for at least one client will enable the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found