-
Notifications
You must be signed in to change notification settings - Fork 52
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
Can I use Header - Authorization for authorization token? #224
Comments
@savager you can, |
That's what I thought, but I get, "no auth token" still.. don't worry i'll figure it out. Thanks! |
@savager strange, if you find smth useful, let me know, please. |
@savager did you figure out how to fix the problem ? |
If i remember correctly I changed the config/passport.js JWT extract to use fromAuthHeader() instead of fromAuthHeaderWithScheme(authScheme) this way worked as Authorization JWT :token: |
In config/passport.js the JWT_STRATEGY_CONFIG const, updated the jwtFromRequest property to this: This way you can still used api_key get param. |
@tlays11 can you create a PR with that change? Does it break |
I'd suggest adding a prompt for body token or header token, and if header use the for me changing to the in config/passport.js change const JWT_STRATEGY_CONFIG = {
secretOrKey: 'c4a071df2a2ef9d0dcce2e38d39d67cee6bba0ddcbe69f21cb2e20ea3d9cd9ef',
jwtFromRequest: ExtractJwt.versionOneCompatibility({authScheme: 'Bearer', tokenBodyField: 'access_token'}),
tokenQueryParameterName: 'access_token',
session: false,
passReqToCallback: true
}; to const JWT_STRATEGY_CONFIG = {
secretOrKey: '2546dd38b356dafb9ea2f6ed75586f883f3c3f1a55f1edc630b3d7eb3689d54e',
jwtFromRequest: ExtractJwt.versionOneCompatibility({
authScheme: 'Bearer',
tokenBodyField: 'access_token'
}),
tokenQueryParameterName: 'access_token',
authScheme: 'Bearer',
session: false,
passReqToCallback: true
}; doing so i'm now able to add an edit: i'm forking and trying to submit a PR which prompts the user for header or body tokens and it looks like the latest version includes the authScheme already not sure if a PR is necessary? |
@mikedevita great, yeah, looks good. You can create a PR for this. I'm not sure if we need to ask a user for this, imho, it should work for both cases without prompting the user. |
@ghaiklor yeah i dont think its required if the current ver supports both. 👍 |
I'm not sure how passport is handling it, but I can only get it working passing auth_token as a parameter at the moment. If this isn't supported that's fine just let me know.
The text was updated successfully, but these errors were encountered: