Fix(auth): improper resolution of relative token urls (#4180)
* fix(auth): improper resolution of relative token urls * revert cc58ba7 for OAS2 In OAS2, relative token URLs are resolved against the host that serves the specs.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import parseUrl from "url-parse"
|
||||
import win from "core/window"
|
||||
import { btoa, buildFormData } from "core/utils"
|
||||
|
||||
@@ -139,13 +140,15 @@ export const authorizeAccessCodeWithBasicAuthentication = ( { auth, redirectUrl
|
||||
return authActions.authorizeRequest({body: buildFormData(form), name, url: schema.get("tokenUrl"), auth, headers})
|
||||
}
|
||||
|
||||
export const authorizeRequest = ( data ) => ( { fn, getConfigs, authActions, errActions, authSelectors } ) => {
|
||||
export const authorizeRequest = ( data ) => ( { fn, getConfigs, authActions, errActions, oas3Selectors, specSelectors } ) => {
|
||||
let { body, query={}, headers={}, name, url, auth } = data
|
||||
let { additionalQueryStringParams } = authSelectors.getConfigs() || {}
|
||||
let fetchUrl = url
|
||||
|
||||
for (let key in additionalQueryStringParams) {
|
||||
url += "&" + key + "=" + encodeURIComponent(additionalQueryStringParams[key])
|
||||
let fetchUrl
|
||||
|
||||
if (specSelectors.isOAS3()) {
|
||||
fetchUrl = parseUrl(url, oas3Selectors.selectedServer()).toString()
|
||||
} else {
|
||||
fetchUrl = parseUrl(url, specSelectors.url()).toString()
|
||||
}
|
||||
|
||||
let _headers = Object.assign({
|
||||
|
||||
Reference in New Issue
Block a user