Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/clients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
}
Expand Down
11 changes: 11 additions & 0 deletions tests/clients.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down