I'm not sure if this issue belongs to passport or passport strategies, but posted it here to get started. I created the same issue to passport repository too, feel free to close this if it belongs to the other repo.
My API authentication currently works so that users send x-token header to authenticate: x-token: <token>. The details of my authentication request don't matter. I might want to send the token or user credentials in query parameters, headers or body.
It seems that passport strategies enforce that the credentials are pulled from req.body object. It would be more generic if I could pass a getter function which would get the credentials req object, like this:
What would be the best solution to overcome this? Create my own strategy? This problem exists at least in passport-local and passport-localapikey. Would you be willing to merge a pull request which would make the library API more generic?
I didn't find this problem mentioned in other issues.
I'm not sure if this issue belongs to passport or passport strategies, but posted it here to get started. I created the same issue to passport repository too, feel free to close this if it belongs to the other repo.
My API authentication currently works so that users send x-token header to authenticate:
x-token: <token>
. The details of my authentication request don't matter. I might want to send the token or user credentials in query parameters, headers or body.It seems that passport strategies enforce that the credentials are pulled from
req.body
object. It would be more generic if I could pass a getter function which would get the credentials req object, like this:What would be the best solution to overcome this? Create my own strategy? This problem exists at least in passport-local and passport-localapikey. Would you be willing to merge a pull request which would make the library API more generic?
I didn't find this problem mentioned in other issues.