Skip to content

Commit 4fcbb68

Browse files
committed
verify PRM resource
1 parent e5b2a5b commit 4fcbb68

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/client/auth.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ export async function auth(
110110
if (resourceMetadata.authorization_servers && resourceMetadata.authorization_servers.length > 0) {
111111
authorizationServerUrl = resourceMetadata.authorization_servers[0];
112112
}
113+
if (resourceMetadata.resource && resourceMetadata.resource !== resource.href) {
114+
throw new Error(`Protected resource ${resourceMetadata.resource} does not match expected ${resource}`);
115+
}
113116
} catch (error) {
114117
console.warn("Could not load OAuth Protected Resource metadata, falling back to /.well-known/oauth-authorization-server", error)
115118
}

0 commit comments

Comments
 (0)