Skip to content
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

make sure scopes are added to redirectURL #6416

Merged
merged 7 commits into from
Sep 22, 2020
Merged
11 changes: 9 additions & 2 deletions src/core/oauth2-authorize.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,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 (typeof scopes !== "undefined" && typeof scopes.toArray === "function") {
dalbrx-forcam marked this conversation as resolved.
Show resolved Hide resolved
scopesArray = scopes.toArray()
}

if (0 < scopesArray.length) {
dalbrx-forcam marked this conversation as resolved.
Show resolved Hide resolved
let scopeSeparator = authConfigs.scopeSeparator || " "

query.push("scope=" + encodeURIComponent(scopes.join(scopeSeparator)))
query.push("scope=" + encodeURIComponent(scopesArray.join(scopeSeparator)))
}

let state = btoa(new Date())
Expand Down