Skip to content

Commit 2f1da8e

Browse files
fix(endpoint-auth): authorization flow
1 parent 41fe610 commit 2f1da8e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/endpoint-auth/lib/controllers/consent.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ export const consentController = {
2727
authType,
2828
me,
2929
redirect_uri,
30-
scopeItems: getScopeItems(scope, response),
30+
scopeItems: scope && getScopeItems(scope, response),
3131
});
3232
} else {
3333
response.redirect(request.baseUrl + "/new-password?setup=true");
3434
}
35-
} catch {
35+
} catch (error) {
36+
console.error("ERROR", error);
3637
throw IndiekitError.badRequest(
3738
response.locals.__("BadRequestError.invalidValue", "request_uri"),
3839
);

packages/endpoint-auth/lib/scope.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ export const supportedScopes = Object.entries(scopes)
2828
*/
2929
export function getScopeItems(scope, response) {
3030
const localisedScopes = Object.keys(scopes);
31-
let requestedScopes = scope || [];
32-
requestedScopes = typeof scope === "string" ? scope.split(" ") : scope;
31+
const requestedScopes = typeof scope === "string" ? scope.split(" ") : scope;
3332

3433
return requestedScopes.map((value) => ({
3534
label: localisedScopes.includes(value)

0 commit comments

Comments
 (0)