Skip to content

Commit 6940114

Browse files
committed
fix: replace dead WorkOS client_id with seeded oauth_do_cli from id.org.ai
Default client_id was client_01JQYTRXK9ZPD8JPJTKDCRB656 (WorkOS format, not registered on id.org.ai). Now uses OAUTH_DO_CLI_CLIENT_ID exported from id.org.ai/auth, pointing to the seeded oauth_do_cli client.
1 parent 05f57ac commit 6940114

8 files changed

Lines changed: 53 additions & 36 deletions

File tree

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "oauth.do",
3-
"version": "0.3.1",
3+
"version": "0.3.2",
44
"description": "OAuth authentication SDK, React components, and Hono middleware for org.ai identity",
55
"type": "module",
66
"sideEffects": false,
@@ -100,7 +100,7 @@
100100
"node": ">=18.0.0"
101101
},
102102
"dependencies": {
103-
"id.org.ai": "^0.2.0",
103+
"id.org.ai": "^0.2.1",
104104
"open": "^10.1.0"
105105
},
106106
"optionalDependencies": {

pnpm-lock.yaml

Lines changed: 38 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cli.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { authorizeDevice, pollForTokens } from './device.js'
1414
import { getUser, logout as logoutFn } from './auth.js'
1515
import { createSecureStorage, SecureFileTokenStorage } from './storage.js'
1616
import { configure } from './config.js'
17-
import { CANONICAL_API_ORIGIN, CANONICAL_AUTHKIT_DOMAIN, DEFAULT_CALLBACK_URL } from 'id.org.ai/auth'
17+
import { CANONICAL_API_ORIGIN, CANONICAL_AUTHKIT_DOMAIN, DEFAULT_CALLBACK_URL, OAUTH_DO_CLI_CLIENT_ID } from 'id.org.ai/auth'
1818

1919
// Color codes for terminal output
2020
const colors = {
@@ -38,7 +38,7 @@ const storage = createSecureStorage()
3838
function configureFromEnv() {
3939
configure({
4040
apiUrl: process.env.OAUTH_API_URL || process.env.API_URL || CANONICAL_API_ORIGIN,
41-
clientId: process.env.OAUTH_CLIENT_ID || 'client_01JQYTRXK9ZPD8JPJTKDCRB656',
41+
clientId: process.env.OAUTH_CLIENT_ID || OAUTH_DO_CLI_CLIENT_ID,
4242
authKitDomain: process.env.OAUTH_AUTHKIT_DOMAIN || CANONICAL_AUTHKIT_DOMAIN,
4343
})
4444
}

src/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { OAuthConfig } from './types.js'
2-
import { CANONICAL_API_ORIGIN, CANONICAL_AUTHKIT_DOMAIN } from 'id.org.ai/auth'
2+
import { CANONICAL_API_ORIGIN, CANONICAL_AUTHKIT_DOMAIN, OAUTH_DO_CLI_CLIENT_ID } from 'id.org.ai/auth'
33
import { getEnv } from './utils.js'
44

55
/**
@@ -8,7 +8,7 @@ import { getEnv } from './utils.js'
88
*/
99
let globalConfig: Omit<Required<OAuthConfig>, 'storagePath'> & Pick<OAuthConfig, 'storagePath'> = {
1010
apiUrl: getEnv('OAUTH_API_URL') || getEnv('API_URL') || CANONICAL_API_ORIGIN,
11-
clientId: getEnv('OAUTH_CLIENT_ID') || 'client_01JQYTRXK9ZPD8JPJTKDCRB656',
11+
clientId: getEnv('OAUTH_CLIENT_ID') || OAUTH_DO_CLI_CLIENT_ID,
1212
authKitDomain: getEnv('OAUTH_AUTHKIT_DOMAIN') || CANONICAL_AUTHKIT_DOMAIN,
1313
fetch: globalThis.fetch,
1414
storagePath: getEnv('OAUTH_STORAGE_PATH'),

src/itty.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*/
99

1010
import * as jose from 'jose'
11+
import { OAUTH_DO_CLI_CLIENT_ID } from 'id.org.ai/auth'
1112
import { getCachedUser, cacheUser, payloadToUser, getJwks } from './auth-shared.js'
1213

1314
// ═══════════════════════════════════════════════════════════════════════════
@@ -73,7 +74,7 @@ export interface ApiKeyOptions {
7374
// Constants
7475
// ═══════════════════════════════════════════════════════════════════════════
7576

76-
const DEFAULT_CLIENT_ID = 'client_01JQYTRXK9ZPD8JPJTKDCRB656'
77+
const DEFAULT_CLIENT_ID = OAUTH_DO_CLI_CLIENT_ID
7778

7879
function getDefaultConfig() {
7980
const clientId = (typeof process !== 'undefined' && process.env?.OAUTH_CLIENT_ID) || DEFAULT_CLIENT_ID

src/react.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ import {
2626
type Impersonator,
2727
type IdentityProviderProps,
2828
} from '@mdxui/auth'
29-
import { CANONICAL_API_ORIGIN, CANONICAL_AUTHKIT_DOMAIN } from 'id.org.ai/auth'
29+
import { CANONICAL_API_ORIGIN, CANONICAL_AUTHKIT_DOMAIN, OAUTH_DO_CLI_CLIENT_ID } from 'id.org.ai/auth'
3030

3131
// ===============================================================================
3232
// oauth.do default configuration
3333
// ===============================================================================
3434

3535
const OAUTH_DO_CONFIG = {
36-
clientId: 'client_01JQYTRXK9ZPD8JPJTKDCRB656',
36+
clientId: OAUTH_DO_CLI_CLIENT_ID,
3737
apiUrl: CANONICAL_API_ORIGIN,
3838
authKitDomain: CANONICAL_AUTHKIT_DOMAIN,
3939
}
@@ -85,7 +85,7 @@ export interface OAuthDoProviderProps {
8585
* OAuth.do Provider - wraps your app with authentication context
8686
*
8787
* Pre-configured with oauth.do defaults:
88-
* - clientId: client_01JQYTRXK9ZPD8JPJTKDCRB656
88+
* - clientId: oauth_do_cli
8989
* - authKitDomain: id.org.ai
9090
* - apiUrl: https://id.org.ai
9191
*

tests/itty.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ describe('itty middleware', () => {
497497
expect(vi.mocked(jose.jwtVerify)).toHaveBeenCalled()
498498
const callArgs = vi.mocked(jose.jwtVerify).mock.calls[0]
499499
expect(callArgs[0]).toBe('valid-token')
500-
expect(callArgs[2]).toEqual({ audience: 'client_01JQYTRXK9ZPD8JPJTKDCRB656' })
500+
expect(callArgs[2]).toEqual({ audience: 'oauth_do_cli' })
501501
})
502502

503503
it('should use custom client ID when provided', async () => {

tests/react.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ describe('React Components', () => {
132132
</OAuthDoProvider>,
133133
)
134134

135-
expect(screen.getByTestId('client-id')).toHaveTextContent('client_01JQYTRXK9ZPD8JPJTKDCRB656')
135+
expect(screen.getByTestId('client-id')).toHaveTextContent('oauth_do_cli')
136136
expect(screen.getByTestId('api-url')).toHaveTextContent('https://id.org.ai')
137137
expect(screen.getByTestId('auth-domain')).toHaveTextContent('id.org.ai')
138138
})
@@ -206,7 +206,7 @@ describe('React Components', () => {
206206
</OAuthDoProvider>,
207207
)
208208

209-
expect(screen.getByTestId('client-id')).toHaveTextContent('client_01JQYTRXK9ZPD8JPJTKDCRB656')
209+
expect(screen.getByTestId('client-id')).toHaveTextContent('oauth_do_cli')
210210
expect(screen.getByTestId('api-url')).toHaveTextContent('https://id.org.ai')
211211
expect(screen.getByTestId('auth-domain')).toHaveTextContent('id.org.ai')
212212
})
@@ -338,7 +338,7 @@ describe('React Components', () => {
338338
fireEvent.click(screen.getByRole('button'))
339339

340340
expect(window.location.href).toContain('https://id.org.ai')
341-
expect(window.location.href).toContain('client_id=client_01JQYTRXK9ZPD8JPJTKDCRB656')
341+
expect(window.location.href).toContain('client_id=oauth_do_cli')
342342
expect(window.location.href).toContain('response_type=code')
343343
})
344344

0 commit comments

Comments
 (0)