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.

Authentication best practices with Redux First?

See original GitHub issue

First off, this is great work – thanks for making this! I’m so happy to have everything in Redux.

Could you provide some pointers/best practices on how authentication fits into this (examples would be amazing)? To be more specific in my case, I’ve been looking at this library for Amazon Cognito, which nicely holds user state in Redux: https://github.com/isotoma/react-cognito

With this library and React Router, one creates a guard

const guard = createGuard(store, '/forbidden');

and then passes it to onEnter in the Route to determine whether to show the user the route or redirect elsewhere if needed.

<Route
     path="/change_email"
     component={updateEmail}
     onEnter={guard()}
/>

What’s the best way to do something like this/handle authentication and routing with Redux First? Appreciate the help!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
faceyspaceycommented, Jun 28, 2017

@bmoquist you’re gonna love the latest update to the Demo:

https://github.com/faceyspacey/redux-first-router-demo

It’s major. It includes lots of authentication filtering stuff. It has SSR + Code Splitting. There’s also updates to this package. So update your deps. The takeaway is redirect in onBeforeChange if not authenticated.

0reactions
bmoquistcommented, Jun 26, 2017

Thanks much for the suggestions – I’ll test them out, and let you know how it goes!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handling user authentication with Redux Toolkit
In this article, you'll learn how to use Redux Toolkit (RTK) and RTK Query to create a frontend authentication workflow in React.
Read more >
Secure Your React and Redux App with JWT Authentication
Learn how to add JWT authentication to your React and Redux app. Use Redux middleware to make secure calls to an API.
Read more >
Set Up User Authentication Using React, Redux, & Redux Saga
A tutorial on how to set up the commonly used login and registration feature ... I thought this would be a good idea...
Read more >
React + Redux - JWT Authentication Tutorial & Example
In this tutorial we'll cover how to implement JWT authentication with React and Redux. The tutorial demo is a simple React + Redux...
Read more >
Adding Authentication to a React/Redux App - Rithm School
Authentication with React and JWTs · actions for sign-up and login (since these are making AJAX calls we will need some async middleware...
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