jaredhanson / jaredhanson/oauth2orize

No options passed to the exchange functions

Open
#183 1 comment 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.