redux-oidc | managing OpenID Connect authentication in ReactJS / Redux | Authentication library
kandi X-RAY | redux-oidc Summary
kandi X-RAY | redux-oidc Summary
This package handles OpenID-Connect authentication in redux apps. It enables redux apps to authenticate with an external OIDC authentication provider and handles the actions of the OpenID implicit flow or authorization code flow. It uses the oidc-client-js library to manage OpenID Connect functionality.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- The handler middleware for storing actions
- Handle user callback
- Infinite error handler .
- Create a user document not found
- Logs the user object expired
- Load user error
- Signs out of the user .
- The loading user has been loaded
- Create a user expiring expiry expired .
- Creates a new Session object .
redux-oidc Key Features
redux-oidc Examples and Code Snippets
Community Discussions
Trending Discussions on redux-oidc
QUESTION
ANSWER
Answered 2021-Dec-09 at 10:36Fixed it, the issue was happening because I needed to add Prevent Default to the button click.
QUESTION
At a loss here, trying to do authorization code flow with oidc-client
and redux-oidc
, in my React app against an ADFS instance as the authorization server. My issue is that I am failing to post to .../adfs/oauth2/token
with the authorization code during my SignInCallback
, visually Part D) in the Diagram here. Every attempt results in a CORS error appearing in my browser, tried on Chrome and Firefox, there is no preflight check and I can see the id_token
, access_token
, and refresh_token
in the response.
I can post from postman to that endpoint with no CORS error. The only workaround I've found was using a browser extension to allow CORS but this isn't suited for production. Why is my browser doing this?
My Config:
...ANSWER
Answered 2021-Jul-06 at 21:19I suspect you are missing standard CORS headers in the response - namely Access-Control-Allow-Origin, and therefore, because the response is not in your SPA's domain, the browser cannot read it.
In ADFS 2019 there are some ways to customize the behaviour.
If this doesn't work for you then another option is to use a Back End for Front End API to proxy certain requests for you. Note also that this approach is recommended in 2021 for SPAs anyway.
QUESTION
First, I know (or I think I've read) that you're never supposed to fire actions from reducers. In my situation, I'm using redux-oidc
to handle authentication against my app. Once the user is logged in, redux-oidc
fires a redux-oidc/USER_FOUND
action and sets the user's profile in the state.oidc.user
slice.
After login, I need to look up additional info about the user from my DB that isn't in the OIDC response. At the moment, I'm firing the fetchUserPrefs
thunk from the redux-oidc.CallbackComponent.successCallback
which works as expected.
My problem is when the user has an active session and opens a new browser, or manually refreshes the page and init's the app again, the callback isn't hit, so the additional user hydration doesn't happen. It seems like what I want to do is add an extraReducer
that listens for the redux-oidc/USER_FOUND
action and triggers the thunk, but this would be firing an action from a reducer.
Is there a better way to do this?
...ANSWER
Answered 2021-May-27 at 22:42You are correct that you cannot dispatch an action from a reducer. You want to listen for an action to be dispatched and dispatch another action in response. That is a job for middleware. Your middleware should look something like this:
QUESTION
We have 3 apps: Client (React/SPA), API (ASP.NET CORE 3.1), and Auth (ASP.NET CORE 3.1 with IdentityServer 4).
Fairly recently, the app is starting to constantly do what appears to be a silent renew. As soon as the client app loads, I can see in the network tab that it immediately hits the authorize endpoint on the identity server, then I see the silent renew page load in an iframe on the app, then it hits the token endpoint on the identity server, then userinfo, and it just keeps cycling through this sequence - just never stops. Over an over. We use redux-oidc, which runs over oidc-client, and I can see within the console that this isn't being done or handled by redux-oidc. I can also see when handling events on the usermnanager that my token isn't expiring, so it doesn't appear to be kicking this off either. We have on our identity server samesite=none with the secure attribute too for cookies that come out of there as well, as I thought that might be the problem, but this is still occurring.
Is there something else we should be looking at? And why would this have all of a sudden recently started happening - we even backed our code out to a version from over a month ago, and the problem still occurs, so we're not aware of any code changes we did that could cause this as this just started happening within the last week I believe.
...ANSWER
Answered 2020-Sep-02 at 21:57HttpOnly
is a flag added to cookies that tell the browser not to display the cookie through client-side scripts. When you set a cookie with the HttpOnly flag, it informs the browser that this special cookie should only be accessed by the server.
But that cookie is required by the OIDC session management spec for JS/SPA clients. If you change it, you will break those types of clients. This is by design, check the spec https://openid.net/specs/openid-connect-session-1_0.html#ChangeNotification
So you are good as is no need to set HttpOnly to true.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install redux-oidc
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