fix(auth): both array and Im.List scopes can be added to redirectURL (#6416)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
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={} } ) {
|
||||
@@ -52,10 +53,17 @@ export default function authorize ( { auth, authActions, errActions, configs, au
|
||||
}
|
||||
query.push("redirect_uri=" + encodeURIComponent(redirectUrl))
|
||||
|
||||
if (Array.isArray(scopes) && 0 < scopes.length) {
|
||||
let scopesArray = []
|
||||
if (Array.isArray(scopes)) {
|
||||
scopesArray = scopes
|
||||
} else if (Im.List.isList(scopes)) {
|
||||
scopesArray = scopes.toArray()
|
||||
}
|
||||
|
||||
if (scopesArray.length > 0) {
|
||||
let scopeSeparator = authConfigs.scopeSeparator || " "
|
||||
|
||||
query.push("scope=" + encodeURIComponent(scopes.join(scopeSeparator)))
|
||||
query.push("scope=" + encodeURIComponent(scopesArray.join(scopeSeparator)))
|
||||
}
|
||||
|
||||
let state = btoa(new Date())
|
||||
|
||||
Reference in New Issue
Block a user