-
Notifications
You must be signed in to change notification settings - Fork 202
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
Allow authorize options to override default values #177
Conversation
@kenzic please can you provide more information in your description, what issue did you run into that required this PR. |
@cocojoe - I want to change the value of the let query = {
...options,
clientId,
responseType: 'code',
redirectUri,
state: expectedState,
...defaults,
}; By switching the order, if |
@cocojoe - Is there anything else you need from me? |
@kenzic Yes, why do you need to do this? The callback URL is standardised across our native platforms. |
@cocojoe I'm running into issues using this along side a framework I'm using. But that's more of an aside. It seems strange that the defaults override the options. Is this intentional? |
@cocojoe following up on this |
@kenzic well the previous comment still stands. #177 (comment) This is not something you can change (intentional) in the dedicated iOS or Android Auth0 libraries, so I would like to know what is the use case here for changing the callback URL. What is your scenario, what framework etc Thx |
The framework I'm using is Expo. Due to a bug in Expo I can't have a custom scheme URL and have the bundle identifier handle linking properly. For example, if I have a bundle identifier Right now, if my app supports the custom URL scheme, the react-native-auth fails. All this being said, it does seem like there are other reasons someone might want to have a custom redirectUri. My specific issue aside, the reason for my request comes down to:
defaults overriding options is seems like either a bug or a bit of a misnomer, and being able to modify the redirectUri seems like it would be pretty useful. |
Thanks for this answer, it's much clearer. So I agree with you that user applied options should override defaults, otherwise there is not much value in the options. So please rebase your PR against latest master and add some tests. 👍 |
@cocojoe - rebased and pushed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@kenzic This could be an issue with anyone who has set weird options but as these would never have been set due to the parameter order merging it would have worked okay. Is a bit of a weird scenario but wanted to voice it. |
@@ -54,12 +54,12 @@ export default class WebAuth { | |||
}/${bundleIdentifier}/callback`; | |||
const expectedState = options.state || state; | |||
let query = { | |||
...options, | |||
...defaults |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That missing comma!!
No description provided.