Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passport object undefined #127

Open
fenichelar opened this issue Feb 15, 2016 · 6 comments
Open

Passport object undefined #127

fenichelar opened this issue Feb 15, 2016 · 6 comments

Comments

@fenichelar
Copy link

When logging in I get an error. I am using Google Auth. The error is produced during the following block in passport.js:

  // Scenario: An existing user is trying to log in using an already
  //           connected passport.
  // Action:   Get the user associated with the passport.
  else {
    // If the tokens have changed since the last session, update them
    if (_.has(query, 'tokens') && query.tokens != passport.tokens) {
      passport.tokens = query.tokens;
    }

    // Save any updates to the Passport before moving on
    return passport.save()
      .then(function (passport) {

        // Fetch the user associated with the Passport
        return sails.models.user.findOne(passport.user.id);
      })
      .then(function (user) {
        next(null, user);
      })
      .catch(next);
  }

return sails.models.user.findOne(passport.user.id); errors because passport is undefined. Any ideas how to fix?

@fruedaCode
Copy link

I'm having the same issue. Any solution??

Thanks!

@pawelhertman
Copy link

@fenichelar @fruedaCode did you solve this problem?

@fruedaCode
Copy link

solve it! thanks!

2016-11-17 13:16 GMT+01:00 Paweł Hertman [email protected]:

@fenichelar https://github.com/fenichelar @fruedaCode
https://github.com/fruedaCode did you solve this problem?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#127 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AVy63ywGWCcNtYtP97rFX-77eW9m7Zb-ks5q_EWigaJpZM4HakwJ
.

@pawelhertman
Copy link

pawelhertman commented Nov 17, 2016

@fruedaCode could you write how did you do that? I know it has been fixed in 2.1.4 version, but the latest version of sails-auth in npm is 2.1.3. I tried to install v2.1.4 directly from repository, but I've got an error "cannot find module 'node_modules/sails-auth'" (although it exists)

@fruedaCode
Copy link

I directly changed that line on dist directory. But i think you could extend passport module and override the function.

@jorgecasar
Copy link

jorgecasar commented Jan 5, 2017

Solved by #128 and released on v2.1.4.

Please @tjwebb, could you publish on NPM the versions 2.1.4 and above?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants