Adding a logout route
See original GitHub issueI have added require('./logout').default,
to routes/index.js and created routes/logout/index.js like so:
export default {
path: '/logout',
action({ req, res }) {
req.session.destroy(function (err) {
res.redirect('/');
});
},
};
But the req and res params are undefined. Is this a correct way to implement a logout route?
I would also prefer to use a post request for logout, can I send a post request to this route?
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
How to logout and redirect to login page using Laravel 5.4?
In your web.php (routes):. add: Route::get('logout', '\App\Http\Controllers\Auth\LoginController@logout');. In your LoginController.php.
Read more >Laravel 9 Logout For Your Authenticated User - Codeanddeploy
Let's implement Laravel logout for your authenticated users. Laravel logout is one of the most ... Step 1: Create a route; Step 2:...
Read more >Logout - Auth0
Describes how logout works with Auth0. ... If you need different redirects for each application, you can add the URLs to your allow...
Read more >Route to logout - Laracasts
Hello, does anyone have the route for in the web.php to logout, ... by Laravel you can simply add Auth::routes(); anywhere in your...
Read more >Add Login Logout Functionality - YouTube
In this video we will add login and logout functionality to our application. We will also use NGX Bootstrap component to display drop-down ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can override default behavior like this:
Also you can use redux action to logout user without page refresh:
There is not session auth in the master branch, so you can just clear cookie for logout:
You may use
mapDispatchToProps
inside react-reduxconnect()
: Redux - Usage with ReactOr dispatch manually: