3.1.3 • Published 12 months ago

@auth-kit/react-router v3.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

This library contains useful functions to manage private routes using react-router or react-router-dom*.

Usage

AuthOutlet

AuthOutlet provides an easy solution using react-router or react-router-dom to manage private-route.

Routes inside the AuthOutlet will stay protected and only properly authenticated users can access the route.

If the user is not authenticated then the user will be redirected to the fallbackPath.

Example

import AuthOutlet from '@auth-kit/react-router/AuthOutlet';

function App() {
 return (
   <Router>
     <Routes>
       <Route element={<AuthOutlet fallbackPath='/login' />}>
         <Route path='/' element={<Users/>} />
         <Route path='/products' element={<Products/>} />
       </Route>
       <Route path='/login' element={<Login/>}/>
     </Routes>
   </Router>
 );
}

RequireAuth

RequireAuth provides a per route base private route solution to implement a private route solution.

Component inside the RequireAuth will stay protected and only properly authenticated users can access the route.

If the user is not authenticated then the user will be redirected to the fallbackPath.

Example

import RequireAuth from '@auth-kit/react-router/RequireAuth';

const RoutesComponent = () => {
 return (
   <BrowserRouter>
     <Routes>
       <Route path={'/'} element={<Home/>}/>
       <Route path={'/login' } element={<Login/>}/>
       <Route path={'/secure'} element={
         <RequireAuth fallbackPath={'/login'}>
           <SecureComponent/>
         </RequireAuth>
       }/>
     </Routes>
   </BrowserRouter>
 )
}

Reference

Reference


3.1.4-alpha.70

12 months ago

3.1.4-alpha.71

12 months ago

3.1.4-alpha.59

1 year ago

3.1.4-alpha.57

1 year ago

3.1.4-alpha.31

1 year ago

3.1.4-alpha.35

1 year ago

3.1.4-alpha.39

1 year ago

3.1.4-alpha.40

1 year ago

3.1.4-alpha.16

1 year ago

3.1.4-alpha.19

1 year ago

3.1.4-alpha.20

1 year ago

3.1.4-alpha.24

1 year ago

3.1.4-alpha.21

1 year ago

3.1.4-alpha.22

1 year ago

3.1.4-alpha.27

1 year ago

3.1.4-alpha.28

1 year ago

3.1.4-alpha.25

1 year ago

3.1.4-alpha.26

1 year ago

3.1.4-alpha.29

1 year ago

3.1.4-alpha.30

1 year ago

3.1.4-alpha.11

1 year ago

3.1.4-alpha.15

1 year ago

3.1.4-alpha.8

1 year ago

3.1.4-alpha.7

1 year ago

3.1.3

1 year ago

3.1.4-alpha.0

1 year ago

3.1.4-alpha.4

1 year ago

3.1.4-alpha.6

1 year ago

3.1.4-alpha.5

1 year ago

3.1.2

1 year ago

3.1.2-alpha.1

1 year ago

3.1.2-alpha.2

1 year ago

3.1.2-alpha.3

1 year ago

3.1.2-alpha.4

1 year ago

3.1.1

1 year ago

3.1.0

1 year ago

3.0.2-alpha.19

1 year ago

3.0.2-alpha.13

1 year ago

3.0.2-alpha.14

1 year ago

3.0.2-alpha.11

1 year ago

3.0.2-alpha.12

1 year ago

3.0.2-alpha.10

1 year ago

3.0.2-alpha.16

1 year ago

3.0.2-alpha.4

1 year ago

3.0.2-alpha.8

1 year ago

3.0.2-alpha.1

1 year ago

3.0.2-alpha.2

1 year ago

3.0.2-alpha.3

1 year ago

3.0.2-alpha.0

1 year ago

3.0.1

1 year ago

3.0.0

1 year ago

3.0.0-alpha.46

1 year ago

3.0.0-alpha.43

2 years ago

3.0.0-alpha.45

2 years ago

3.0.0-alpha.44

2 years ago

3.0.0-alpha.36

2 years ago

3.0.0-alpha.35

2 years ago

3.0.0-alpha.41

2 years ago

3.0.0-alpha.17

2 years ago

3.0.0-alpha.2

2 years ago

1.0.0

2 years ago