uttej Terlapu
uttej Terlapu

Reputation: 1

How to create a Cookie and send it to my react (Frontend) browser and have a cookie based authentication System and a Private route to my Home page

The constraint here was to Create a Cookie without the JWT.

I had tried Creating but it was not able to access at the frontend browser to activate the private route allow for PrivateRoutes i this the major logic to it here if the Cookie is generated there should be true value else false to it

import { Outlet, Navigate } from 'react-router-dom'

const PrivateRoutes = () => {
    let auth = {'token': false}
    return(
        auth.token ? <Outlet/> : <Navigate to="/login"/>
    )
}

export default PrivateRoutes

Can anyone help me to create the cookie and send to frontend browser and store in the application >cookies and able to do authentication upon it (NO JWT).If anyone Have any resources post here.

Upvotes: 0

Views: 83

Answers (0)

Related Questions