|
|
@@ -1,8 +1,9 @@ |
|
|
|
import parseUrl from "url-parse" |
|
|
|
import win from "core/window" |
|
|
|
import Im from "immutable" |
|
|
|
import { btoa, sanitizeUrl, generateCodeVerifier, createCodeChallenge } from "core/utils" |
|
|
|
|
|
|
|
export default function authorize ( { auth, authActions, errActions, configs, authConfigs={} } ) { |
|
|
|
export default function authorize ( { auth, authActions, errActions, configs, authConfigs={}, currentServer } ) { |
|
|
|
let { schema, scopes, name, clientId } = auth |
|
|
|
let flow = schema.get("flow") |
|
|
|
let query = [] |
|
|
@@ -95,7 +96,17 @@ export default function authorize ( { auth, authActions, errActions, configs, au |
|
|
|
} |
|
|
|
|
|
|
|
const authorizationUrl = schema.get("authorizationUrl") |
|
|
|
const sanitizedAuthorizationUrl = sanitizeUrl(authorizationUrl) |
|
|
|
let sanitizedAuthorizationUrl |
|
|
|
if (currentServer) { |
|
|
|
// OpenAPI 3 |
|
|
|
sanitizedAuthorizationUrl = parseUrl( |
|
|
|
sanitizeUrl(authorizationUrl), |
|
|
|
currentServer, |
|
|
|
true |
|
|
|
).toString() |
|
|
|
} else { |
|
|
|
sanitizedAuthorizationUrl = sanitizeUrl(authorizationUrl) |
|
|
|
} |
|
|
|
let url = [sanitizedAuthorizationUrl, query.join("&")].join(authorizationUrl.indexOf("?") === -1 ? "?" : "&") |
|
|
|
|
|
|
|
// pass action authorizeOauth2 and authentication data through window |
|
|
|