jaredhanson / jaredhanson/oauth2orize
No options passed to the exchange functions
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 3.5k
- Forks
- 472
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I have noticed an issue in the code while I was trying to setup the password exchange.
I need to set the `options.userProperty` of the `exchange/password.js` file [(this line)](https://github.com/jaredhanson/oauth2orize/blob/master/lib/exchange/password.js#L67), so that it does not my `user` property in my request, however, I noticed that the other functions which call the exchange function, do not pass my option variable to it. For this case, I am using `middleware/token.js` with the options I need, however, it seems that the `server._exchange` never passes my options [(this line](https://github.com/jaredhanson/oauth2orize/blob/master/lib/middleware/token.js#L56) and [this line)](https://github.com/jaredhanson/oauth2orize/blob/master/lib/server.js#L386).
Also, I tried to send my `options` at the time I am passing my `issue` function to the exchange, as the first argument, however, the exchange function in the `server.js` file, only gets issue function and the exchange type, but not the `options` value [(line)](https://github.com/jaredhanson/oauth2orize/blob/master/lib/server.js#L118).
I believe this issue is true for all the four exchanges we have, and someone needs to modify the options value as needed, but they cannot. I think either of the above approaches (`options` as an argument to `exchange` function or passing `options` to the `server._exchange` or both) can be a solution.
This [open issue](https://github.com/jaredhanson/oauth2orize/issues/141) is also related to my issue and I tried to use the `userProperty` to address the aforementioned issue.
Thank you for your attention.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Trace the option flow from lib/middleware/token.js and lib/server.js into lib/exchange/password.js, then compare it with the other exchange implementations. Verify how exchange configuration is registered and invoked; done means configured options, including userProperty, reach each exchange consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- authentication, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100