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
[legacy-framework] Allow the ctx
to be accessed within passport strategies
#2058
Conversation
I tested this with the example auth project locally and it works as expected. The only problem is, each strategy displays a typescript error whenever the If you have any ideas why this could be happening, I'm happy to make the changes so this does not error! Thanks |
wow that is weird 🤔 I tried a few things and couldn't get it to work either. Also, you can go ahead and open a PR to the docs repo to document this |
For anyone else looking at this, do this:
|
Yeah. I'll give it another go tomorrow, but something tells me this could be a bug with typescript. It just doesn't make sense.
Done! blitz-js/blitzjs.com#399 |
Interesting. After a bit more investigation, I found the problem is the environment variables (whos types are guaranteed by the I guess this makes sense as these variables could technically change. The option would be to typecast: consumerKey: process.env.TWITTER_CONSUMER_KEY as string, Or add something like an declare global {
namespace NodeJS {
interface ProcessEnv {
TWITTER_CONSUMER_KEY: string;
TWITTER_CONSUMER_SECRET: string;
}
}
}
export {}; I'll go for the |
Sweet! Let's go with the And let's add that type cast to the docs to, or at least mention it somehow there |
Yeah, it's a good point. I also thought the environment.d.ts file approach could confuse people if they are copy and pasting.
Will do. |
ctx
to be accessed within passport strategies
ctx
to be accessed within passport strategiesctx
to be accessed within passport strategies
Closes: blitz-js/legacy-framework#201
What are the changes and their implications?
This change allows access to the session inside the verify callback of the passport strategy.
Checklist