I'm rewriting an authentication system to be OAuth only with Passport JS. I've designed a user flow as described below, but I can't see where the best point to get Passport to interact with information from the original request is.
The flow will be:
- Authenticated user sends invitation to a new user's email address
- New user clicks on link and lands on invitation page (/invitation/SOMECODE)
- Invitation code is verified and, if still valid, allows user to auth via Google/Slack
- New profile is created in the Strategy, but associated with the existing company (instead of creating a new one)
I'm looking to get access to the req.params inside of the Google Strategy, because this is the point I would typically create a new profile, and company for first time users. But if there's an invitation code, I want to do lookups on that info at this point.
I can't see any documentation that supports this approach, other than Node Passport invitation strategy which uses a password after initial sign up.
Can you get access to req object inside the strategy or is there a better way to approach this with another middleware?