-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
implement auth with the Flux based router #70
Comments
ping @koistya |
@frankleng I'm going to include auth flow example into this kit, hopefully next week. |
@koistya that'll be great if you have time this week. also with that said, it'll be nice to have a sample for simple redirects. |
@koistya I'm also trying to learn how to implement auth with React, would love an example. |
+1 |
The nuclearmail app (https://github.com/ianobermiller/nuclearmail) has a working example of auth using the Gmail REST API |
@koistya An example of auth with react-router would be great, have you had any more look into this? |
+1, i spent the whole sunday afternoon trying to get this running, trying to keep my code isomorphic and following the flux architecture without success. I believe this is a deal breaker for many, if anyone already have a working solution to share that would be really handy. |
Here is an example of an alternative routing approach: Implementing React.js routing from scratch (docs/recipe) Where you can check authentication in several ways: router.route('/store/checkout', async () => {
if (!this.user.isAuthenticated) {
this.throw(401, 'You must be authenticated.');
} else {
const data = await http.get('/api/cart/items');
this.render(require('./components/Checkout'), data);
}
}); router.route('/store/checkout', authorize('user'), async () => { ... });
/* where `authorize(..)` is just a regular route handler */ router.route('/store/*', async () => { /* check authentication via `this.user` */ })
router.route('/store/checkout', async () => { /* load data, return component to render */ }); |
@koistya the example code has |
@constantx fixed 'How to implement routing' recipe in 9891699 |
@koistya rad, will check it out |
any tip on handling redirect? I'm having a hard time figuring out where to do it (in a store? action? component?) |
@constantx one way is to use |
Another way.. is to add this redirect logic to the router, I will try to do it later |
@koistya rad, looking forward to it, thanks for all the hard work! |
@koistya, awesome work thanks. I agree it would be great to have an auth example route in the kit. |
@koistya Would also love an auth example route. |
+1 |
Could be great ! +1 |
@koistya Any progress on this? A working example of a basic auth workflow - token, cookie, user object handling, would be super beneficial for the kit! |
I use express middleware to ensure authentication for API endpoints. I also use a higher level component to handle component by component permissions. It was a pain to implement this. Would love to see this project move to react router 1.0. |
@constantx @9mm @gmlnchv @lovegroveandy @ACPK
|
This is really old issue. |
@koistya mind giving an example of how to setup an auth flow with the current setup?
One of the biggest perks of switching to react-router is the out of box support for auth by using nested routes. thanks! ref #21
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: