Describe the bug
When the third party authorization server URL is not an origin, the oauth authorization server metadata URL is resolved to the origin of the passed url.
This is due to the prefixed / in the relative URL path in
|
const url = new URL("/.well-known/oauth-authorization-server", authorizationServerUrl); |
Refactoring the above to something like const url = new URL(authorizationServerUrl + ".well-known/oauth-authorization-server"); will fix this.
To Reproduce
-
Configure an authorization server path with a base path in MCP server's protected resource metadata. (eg: https://api.asgardeo.io/t/pavinduorg)
-
Observe that the oauth authorization server metadata URL is resolved to https://api.asgardeo.io/.well-known/oauth-authorization-server instead of https://api.asgardeo.io/t/pavinduorg/.well-known/oauth-authorization-server
Expected behavior
Authz metadata url construction should not omit the basepath of authorization server URL.
Logs
N/A
Additional context
N/A
Describe the bug
When the third party authorization server URL is not an origin, the oauth authorization server metadata URL is resolved to the origin of the passed url.
This is due to the prefixed / in the relative URL path in
typescript-sdk/src/client/auth.ts
Line 272 in 0516f98
Refactoring the above to something like
const url = new URL(authorizationServerUrl + ".well-known/oauth-authorization-server");will fix this.To Reproduce
Configure an authorization server path with a base path in MCP server's protected resource metadata. (eg:
https://api.asgardeo.io/t/pavinduorg)Observe that the oauth authorization server metadata URL is resolved to
https://api.asgardeo.io/.well-known/oauth-authorization-serverinstead ofhttps://api.asgardeo.io/t/pavinduorg/.well-known/oauth-authorization-serverExpected behavior
Authz metadata url construction should not omit the basepath of authorization server URL.
Logs
N/A
Additional context
N/A