{"action":"opened","issue":{"url":"https://api.github.com/repos/langateam/sails-auth/issues/154","repository_url":"https://api.github.com/repos/langateam/sails-auth","labels_url":"https://api.github.com/repos/langateam/sails-auth/issues/154/labels{/name}","comments_url":"https://api.github.com/repos/langateam/sails-auth/issues/154/comments","events_url":"https://api.github.com/repos/langateam/sails-auth/issues/154/events","html_url":"https://github.com/langateam/sails-auth/issues/154","id":169202115,"number":154,"title":"LinkedIn Passport provider saved as null","user":{"login":"Garland220","id":1590832,"avatar_url":"https://avatars.githubusercontent.com/u/1590832?v=3","gravatar_id":"","url":"https://api.github.com/users/Garland220","html_url":"https://github.com/Garland220","followers_url":"https://api.github.com/users/Garland220/followers","following_url":"https://api.github.com/users/Garland220/following{/other_user}","gists_url":"https://api.github.com/users/Garland220/gists{/gist_id}","starred_url":"https://api.github.com/users/Garland220/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Garland220/subscriptions","organizations_url":"https://api.github.com/users/Garland220/orgs","repos_url":"https://api.github.com/users/Garland220/repos","events_url":"https://api.github.com/users/Garland220/events{/privacy}","received_events_url":"https://api.github.com/users/Garland220/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-08-03T18:36:23Z","updated_at":"2016-08-03T18:36:23Z","closed_at":null,"body":"I'm using [https://github.com/auth0/passport-linkedin-oauth2](this) LinkedIn passport plugin, and I ran into an issue where provider was being saved as null.\r\n\r\nI fixed this by changing a few things in the passport service, but I want to know if this was a bug, or if I should have handled this some other way:\r\n\r\n```javascript\r\npassport.connect = function (req, query, profile, next) {\r\n  var user = { };\r\n\r\n  // Use profile.provider or fallback to the query.provider if it is undefined\r\n  // as is the case for OpenID, for example\r\n  var provider = profile.provider || req.param('provider');\r\n\r\n  req.session.tokens = query.tokens;\r\n\r\n  // Get the authentication provider from the query.\r\n  query.provider = provider;\r\n```\r\n\r\nI moved `var provider` up, and changed it to fallback to the request param, then set `query.provider` to the result of `var provider`. This meant that no matter what `query.provider` would be set to something. Previously it was undefined when it was being saved in the passport model.\r\n\r\nShould I make a pull request for this small change, or was this unnecessary? "}}
{"actor":{"display_login":"Garland220"}}