-
-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Authorization flow example #826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
There may be some examples in Awesome Redux. |
i'd love to create one if you'll outline the requirements! 📄 |
@olegakbarov What kind of requirements are you interested in? If you are interested in style, see the other examples and base yours off of those. Files like webpack.config.js, server.js, and others can be re-used from the existing examples. You should also try and keep it as simple as possible. Take a stab at it and people can give you feedback. |
I'd love a simple guide to working with JWTs in redux. 👍 |
https://preact.gitbooks.io/react-book/content/flux/auth.html is also a good example on how to handle this. |
After having implemented this in a production application i'm going to strip it out as a |
@Nicktho sweet. Look forward to it. |
+1 for redux-jwt. Let us know when it's ready for testing ;) Do you use react-router? I'm having problems implementing auth with react-router, redux and redux-router. I think the entire community is having problems with it, and we should address this issue. |
I'm not quite sure how to implement the server the redux example way — i mean we gotta have some async api, right? |
Nothing special. |
Meaning, REST-like APIs (or really any kind of APIs) are fine to use with Redux. It doesn't care. |
Please add some documentation :) I would love to help, but this is beyond me. This problem has been bugging me for a few days now. I use redux-router and can't figure out how to do server rendering with jwt authentication (I store token in cookie). I know this is not the right place to ask, but maybe you can at least point me into the right direction. How or where should we load initial user data into store? How to pass store to the route onEnter hook with redux-router on server, when I have this
Do we dispatch inside requireAuth? How do we handle this in development? For example I use webpack-hot-middleware and in dev I don't do server rendering, so how to load user in this case? At the moment I have two different requireAuth functions for server and client. But it feels wrong so I decided to stop and understand the situation. Would love to read some more docs, especially for redux-router. This is my server code
Keep up the good work! |
Please create a StackOverflow question for this. |
I've recently started a general purpose library for redux + auth with react-router since this question comes up so often. (and I'd like to reuse it across apps more easily) It uses a Higher Order Component method for enforcing both authentication and authorization on the "wrapped" components. Maybe this is something that should be included in docs somewhere? Or eventually become part of rackt? In my experience using HOC as opposed to onEnter (from React-Router) is easier with redux. https://github.com/mjrussell/redux-auth-wrapper |
@mjrussell Nice! Recently I've implemented similar approach in a couple projects, but not published as a library. In case you want to compare some ideas, here it is: #1336 (comment) |
@sompylasar cool, thanks I hadn't seen your approach before but definitely looks similar! Appreciate the link back in the other issue |
This is a really nice article on the subject: https://auth0.com/blog/2016/01/04/secure-your-react-and-redux-app-with-jwt-authentication/ |
Don't know if people have seen this yet: https://github.com/mxstbr/login-flow |
The article that @gaearon pointed out is excellent. Pretty much covers everything you would need to do when handling authentication with JWT. I would try and build from this. |
Do you guys interested in authorization flow example (Redux + React Router)? If so what are the key requirements to it?
We got some kind of it, but it is slightly verbose.
The text was updated successfully, but these errors were encountered: