Throw error if scopes are requested and client has none

This commit is contained in:
Justin Spahr-Summers 2025-02-21 11:55:46 +00:00
commit 094b81f70d
No known key found for this signature in database

View file

@ -120,9 +120,9 @@ export function authorizationHandler({ provider, rateLimit: rateLimitConfig }: A
// Validate scopes
let requestedScopes: string[] = [];
if (scope !== undefined && client.scope !== undefined) {
if (scope !== undefined) {
requestedScopes = scope.split(" ");
const allowedScopes = new Set(client.scope.split(" "));
const allowedScopes = new Set(client.scope?.split(" "));
// Check each requested scope against allowed scopes
for (const scope of requestedScopes) {