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-auth0 provider callback route not triggered #239

Open
2 tasks done
daniellwdb opened this issue Jul 3, 2021 · 1 comment
Open
2 tasks done

passport-auth0 provider callback route not triggered #239

daniellwdb opened this issue Jul 3, 2021 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@daniellwdb
Copy link
Contributor

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure it has not already been reported

Fastify version

^3.18.1

Plugin version

No response

Node.js version

16.3.0

Operating system

Linux

Operating system version (i.e. 20.04, 11.3, 10)

Ubuntu 20.04

Description

Using passport-auth0 things seem to work fine until it comes to the callback route, the callback route is not triggered, in the browser when checking the console, errors below show:

message: "Timeout after calling success log."
description: "Should have closed the web view."

Steps to Reproduce

For this project I set up an auth0 regular web application, then I followed the passport-auth0 and fastify-passport docs to set up the provider, when I go to the auth0 route, I can sign in and in the console I see a success message with an authResult object, however after a while a white page is shown with console errors as shown in this issue description

fastifyPassport.use(
  new Auth0Strategy(
    {
      domain: process.env.AUTH0_DOMAIN,
      clientID: process.env.AUTH0_CLIENT_ID,
      clientSecret: process.env.AUTH0_CLIENT_SECRET,
      callbackURL: `${process.env.SERVER_URL}/auth/auth0/callback`,
    },
    (_accessToken, _refreshToken, _extraParams, profile, done) => {
      return done(undefined, profile)
    }
  )
)

fastify.get(
  "/auth0",
  {
    preValidation: fastifyPassport.authenticate("auth0", {
      scope: "openid email profile",
    }),
  },
  // eslint-disable-next-line @typescript-eslint/no-empty-function
  async () => {}
)

fastify.get(
  "/auth0/callback",
  {
    preValidation: fastifyPassport.authenticate("auth0"),
  },
  async (_request, reply) => {
    return reply.send(JSON.stringify(_request.user, undefined, 2))
  }
)

Expected Behavior

I would expect to be redirected to the callback route

@mcollina
Copy link
Member

mcollina commented Jul 9, 2021

Looks like a nasty bug!

Would you like to send a Pull Request to address this issue? Remember to add unit tests.

@mcollina mcollina added bug Something isn't working good first issue Good for newcomers labels Jul 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants