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 authentication fails after login #3218

Closed
rubenamorim opened this issue Jul 1, 2020 · 0 comments · Fixed by #3219
Closed

Passport authentication fails after login #3218

rubenamorim opened this issue Jul 1, 2020 · 0 comments · Fixed by #3219

Comments

@rubenamorim
Copy link

Bug report

Describe the bug

When authentication is performed and the query to create the session is executed, the application crashes. After the query execution, an invalid destructuring is made on the result.

The query result is an object like this:

{ session: { item: { id: XXX } } }

Wrongly, an object like this is expected:

{ sessionItem: { session: { item: { id: XXX } } } }

This is a regression introduced by 431cf76b0 in this line.

To Reproduce

  1. Add google auth strategy to the application
const googleStrategy = {
    type: GoogleAuthStrategy,
    list: 'User',
    config: {
        appId: process.env.GOOGLE_APP_ID,
        appSecret: process.env.GOOGLE_APP_SECRET,
        idField: 'googleId',
        loginPath: '/auth/google',
        callbackPath: '/auth/google/callback',
        onAuthenticated: (data, req, res) => {
            res.redirect('/');
        },
        onError: (error, req, res) => {
            console.error(error);

            res.redirect('/error');
        },
    },
};

keystone.createAuthStrategy(googleStrategy);
  1. Try to sign in
  2. The login crashes and the onError callback is called

Expected behaviour

The login must be successful and the onAuthenticated callback is called.

Screenshots

Screenshot 2020-07-01 at 21 45 56

System information

  • OS: macOS 10.15.5
  • Browser: Chrome: 83.0.4103.116
  • Node: 12.18.1
  • Yarn: 1.22.4
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

Successfully merging a pull request may close this issue.

1 participant