Closed kirill-konshin closed 7 years ago
The third option is the options you can pass in. It should work exactly how you propose. Headers also work the same way. Please check the snippet of code you pasted, in particular https://github.com/mulesoft/js-client-oauth2/blob/master/src/client-oauth2.js#L418.
IC, since it's processed by requestOptions
it will work as I've described. Closing.
Hi, is there no way to overwrite the grant_type? I see that this functions allows me to add custom properties but not overwrite some others like grant_type.
function requestOptions (requestOptions, options) {
return extend(requestOptions, {
body: extend(options.body, requestOptions.body),
query: extend(options.query, requestOptions.query),
headers: extend(options.headers, requestOptions.headers),
transport: extend(options.transport, requestOptions.transport)
})
}
I think it should be the opposite like:
body: extend(requestOptions.body, options.body)
I didn't want it to be possible to override the explicit configuration from this module, but I suppose that could be changed to make it easier in cases where you need that. Can you share an example of where you'd want to override grant_type
?
Maybe it something too specific, but we have 2 different types of user registration because we are migrating to one system to another step by step. So we are handling 2 different authentications and what we are doing is handling it using grant_type=password and grant_type=password2 to be able to apply some different logic in the backend.
For now, I've solved that using my own function for "grant_type=password2" and then creating the token object using "createToken" function and start using the same chain promises from this point.
In RingCentral system we use
username
,extension
andpassword
and currently there is no way to setextension
inOwnerFlow.getToken
:I propose to pass initial body through
options.body
.Also I noticed that there is no way to pass additional headers...