{"action":"created","issue":{"url":"https://api.github.com/repos/jaredhanson/passport/issues/208","labels_url":"https://api.github.com/repos/jaredhanson/passport/issues/208/labels{/name}","comments_url":"https://api.github.com/repos/jaredhanson/passport/issues/208/comments","events_url":"https://api.github.com/repos/jaredhanson/passport/issues/208/events","html_url":"https://github.com/jaredhanson/passport/issues/208","id":28352801,"number":208,"title":"Document req.login for refreshing req.user","user":{"login":"Zugwalt","id":417605,"avatar_url":"https://avatars.githubusercontent.com/u/417605?v=3","gravatar_id":"","url":"https://api.github.com/users/Zugwalt","html_url":"https://github.com/Zugwalt","followers_url":"https://api.github.com/users/Zugwalt/followers","following_url":"https://api.github.com/users/Zugwalt/following{/other_user}","gists_url":"https://api.github.com/users/Zugwalt/gists{/gist_id}","starred_url":"https://api.github.com/users/Zugwalt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zugwalt/subscriptions","organizations_url":"https://api.github.com/users/Zugwalt/orgs","repos_url":"https://api.github.com/users/Zugwalt/repos","events_url":"https://api.github.com/users/Zugwalt/events{/privacy}","received_events_url":"https://api.github.com/users/Zugwalt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2014-02-26T17:35:46Z","updated_at":"2015-06-19T09:40:16Z","closed_at":null,"body":"I hit a use case where I needed to refresh `req.user` with new information without logging in and out. Somebody on Stack Overflow pointed me to calling `req.login()` with the updated values. However nowhere is this in the documentation--would love to see it there! "},"comment":{"url":"https://api.github.com/repos/jaredhanson/passport/issues/comments/113447451","html_url":"https://github.com/jaredhanson/passport/issues/208#issuecomment-113447451","issue_url":"https://api.github.com/repos/jaredhanson/passport/issues/208","id":113447451,"user":{"login":"samhuntsocial","id":8858588,"avatar_url":"https://avatars.githubusercontent.com/u/8858588?v=3","gravatar_id":"","url":"https://api.github.com/users/samhuntsocial","html_url":"https://github.com/samhuntsocial","followers_url":"https://api.github.com/users/samhuntsocial/followers","following_url":"https://api.github.com/users/samhuntsocial/following{/other_user}","gists_url":"https://api.github.com/users/samhuntsocial/gists{/gist_id}","starred_url":"https://api.github.com/users/samhuntsocial/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samhuntsocial/subscriptions","organizations_url":"https://api.github.com/users/samhuntsocial/orgs","repos_url":"https://api.github.com/users/samhuntsocial/repos","events_url":"https://api.github.com/users/samhuntsocial/events{/privacy}","received_events_url":"https://api.github.com/users/samhuntsocial/received_events","type":"User","site_admin":false},"created_at":"2015-06-19T09:40:16Z","updated_at":"2015-06-19T09:40:16Z","body":"@zhiyelee, please look at my above post, my part on \"When User Info has Changed\" should give you some hints. I also included some background information so you get the complete picture. \r\n\r\nIf you want to update user info, you got to update the value in your database first or your Node memory first, depending on what you're using to keep track of logged in users. Do that first, and deserializeUser() will automatically update the new value in req.user. Because deserializeUser()  actually searches for the user in your database or Node memory and copies that user info into session. \r\n\r\nSo you don't have to change any code in deserializeUser(), you just got to replace your req.login() code with something that updates the user in the database or memory. I don't think you need to call req.login() if you're just updating the user info. Plus \"login\" is not what you're doing so your code would be kind of misleading to use the word \"login\".\r\n\r\nHere's my deserializeUser code inside the Passport Strategy: \r\n\r\n```javascript\r\npassport.deserializeUser(function(id, done) {\r\n    User.findByIdInMemory(id, function(err, user) {\r\n        done(err, user);\r\n    });\r\n});\r\n```\r\n\r\nHere's my code where I update the user info in Node memory, I call this in my routes: \r\n\r\n```javascript\r\nUser.updateUserInMemory = function(user) {\r\n\r\n    // Find the user in the 'users' array by token ID\r\n    for (var i=0; i<users.length; i++) {\r\n        if (users[i].IDToken == user.IDToken) { \r\n\r\n            // update this user's fields in the 'users' array, except for the token ID\r\n            users[i].username = user.username; \r\n            users[i].email = user.email; \r\n        }\r\n    };\r\n};\r\n```"}}