fnakstad / angular-client-side-auth

One way to implement authentication/authorization in Angular applications
http://angular-client-side-auth.herokuapp.com/
MIT License
1.63k stars 346 forks source link

Delete cookie removal #50

Closed franleplant closed 10 years ago

franleplant commented 10 years ago

Delete user Cookie Removal since it is handled by Passport from the backend and it really does not delete the user cookie.

franleplant commented 10 years ago

Please, ignore this PR. Answer this to me and I will erase it. How do you set the "user" cookie? I was searching through your code and there is no explicit actions to do it, does passport do that implictly?

iotaweb commented 10 years ago

The cookie is set server side here: /server/routes.js

    {
        path: '/*',
        httpMethod: 'GET',
        middleware: [function(req, res) {
            var role = userRoles.public, username = '';
            if(req.user) {
                role = req.user.role;
                username = req.user.username;
            }
            res.cookie('user', JSON.stringify({
                'username': username,
                'role': role
            }));
            res.render('index');
        }]
    }
franleplant commented 10 years ago

Great thanks!

fnakstad commented 10 years ago

I'll go ahead and close this PR then. Merry Christmas :)