From 197d520a2b98d8d2ce90918d8bee36a198f94786 Mon Sep 17 00:00:00 2001 From: Jonnie Lappen Date: Fri, 20 Nov 2026 19:20:44 -0700 Subject: [PATCH] fix(auth): recognise the ChatGPT connector's Client ID Metadata Document --- src/clients.ts | 3 +++ tests/clients.test.ts | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/clients.ts b/src/clients.ts index 246bdff65..40a04a3e5 100644 --- a/src/clients.ts +++ b/src/clients.ts @@ -51,6 +51,9 @@ const KNOWN_CLIENTS: readonly KnownClient[] = [ { id: 'chatgpt', name: 'ChatGPT', + // The ChatGPT connector authorizes with this Client ID Metadata Document; older + // connections were dynamically registered with a chatgpt.com redirect URI. + clientIdMetadataDocument: 'https://chatgpt.com/oauth/client.json', redirectUriHosts: ['chatgpt.com'], behavior: { scopeChallenge: 'tool' } } diff --git a/tests/clients.test.ts b/tests/clients.test.ts index ffb2a16bb..785b2bbe2 100644 --- a/tests/clients.test.ts +++ b/tests/clients.test.ts @@ -15,6 +15,17 @@ describe('identifyClient', () => { expect(redirectUris).not.toHaveBeenCalled() }) + it('recognises the ChatGPT connector by its Client ID Metadata Document without reading redirect URIs', async () => { + const redirectUris = vi.fn(noRedirectUris) + const client = await identifyClient({ + clientId: 'https://chatgpt.com/oauth/client.json', + redirectUris + }) + + expect(client).toEqual({ id: 'chatgpt', behavior: { scopeChallenge: 'tool' } }) + expect(redirectUris).not.toHaveBeenCalled() + }) + it('gives any other metadata document client the spec behavior without reading redirect URIs', async () => { const redirectUris = vi.fn(noRedirectUris) const client = await identifyClient({