Skip to content

Commit 6220701

Browse files
committed
Fix trailing slash
1 parent da6ac79 commit 6220701

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/client/auth.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,12 @@ export async function discoverOAuthMetadata(
299299
): Promise<OAuthMetadata | undefined> {
300300
const issuer = new URL(authorizationServerUrl);
301301

302-
const wellKnownPath = `/.well-known/oauth-authorization-server${issuer.pathname}`;
303-
const url = new URL(wellKnownPath, authorizationServerUrl);
302+
let wellKnownPath = `/.well-known/oauth-authorization-server${issuer.pathname}`;
303+
if (issuer.pathname.endsWith('/')) {
304+
// Strip trailing slash from pathname
305+
wellKnownPath = wellKnownPath.slice(0, -1);
306+
}
307+
const url = new URL(wellKnownPath, issuer);
304308

305309
let response: Response;
306310
try {

0 commit comments

Comments
 (0)