-
Notifications
You must be signed in to change notification settings - Fork 176
Readme example not working with master #141
Comments
Also it seems that options.passReqToCallback it is always set to true: in bearerStrategy.js Making the following conditional not necessary (BearerStrategy Line 177) ?
|
Also documentation is wrong:
I am happy to create a PR if you think all of the above issues are correct. |
@yarandoo I tried the sample using the master branch passport code, I didn't get the "Done is not a function" error. Is the 'passReqToCallback' set to 'false' in your server_config.js? There are two 'passReqToCallback' parameters involved in this code, one for the Strategy, one for the BearerStrategy (which Strategy inherits) (Yes, that's confusing...) In the following code: In the following code: I suspect your verifyFn takes (token, done), but your options.passReqToCallback is 'true'. If this is not your setting, please let me know, thanks! |
Please reopen if you believe this is still an issue, @yarandoo. |
Hi there, I've had the same problem, and I strongly believe this is still an issue. My passReqToCallback from server_config.js was set to false, but obviously the
made it useless. I got rid of the "Done is not a function" changing
to
after having applied the code provided in #112 and #117 to finally made the Bearer strategy work as expected. It is very hard to figure out what to do to fix such issues, I had to dig into closed issues to see what was wrong, PLEASE update your samples and update the version available from npm. |
Hi,
I am using master branch (As it has fixes #117 #112), and the readme sample: "OAuth2Bearer Strategy" is not working.
The callback function(Verify) receives only 2 params: (token, done)
new BearerStrategy(options, **function(token, done)** {
When using this code I found out that actually the verify cb function gets called with 3 params (req, token, done) and thus generating and error when trying to call done. Which in this case done is the token.
Is this an error in the readme or myself not correctly using the library?
Using a 3 params callback function solves the issue.
The text was updated successfully, but these errors were encountered: