🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
✨ feat(oidc): add toby as a built-in native client (#21429)
Inneibf8d62fdd57a
diff --git a/src/features/Auth/OAuthConsent/Consent/index.tsx b/src/features/Auth/OAuthConsent/Consent/index.tsxindex 6b76626962d..effd9521960 100644--- a/src/features/Auth/OAuthConsent/Consent/index.tsx+++ b/src/features/Auth/OAuthConsent/Consent/index.tsx@@ -27,7 +27,7 @@ function getScopeDescription(scope: string, t: any): string {return t(`consent.scope.${scope.replace(':', '-')}`, scope);}-const BUILTIN_CLIENTS = new Set(['lobehub-desktop', 'lobehub-mobile', 'lobehub-market']);+const BUILTIN_CLIENTS = new Set(['lobehub-desktop', 'lobehub-mobile', 'lobehub-market', 'toby']);const ConsentClient = memo<ClientProps>(({ acceptanceReview, uid, clientId, scopes, clientMetadata }) => {diff --git a/src/libs/oidc-provider/config.ts b/src/libs/oidc-provider/config.tsindex addcfb669bd..13316bf63f4 100644--- a/src/libs/oidc-provider/config.ts+++ b/src/libs/oidc-provider/config.ts@@ -58,6 +58,18 @@ export const defaultClients: ClientMetadata[] = [// Public client with no secrettoken_endpoint_auth_method: 'none',},+ {+ application_type: 'native',+ client_id: 'toby',+ client_name: 'toby',+ grant_types: ['authorization_code', 'refresh_token'],+ post_logout_redirect_uris: [],+ // Universal-link callback: iOS only hands it to the app listed in the AASA webcredentials,+ // so another app cannot impersonate toby the way it could with a custom scheme.+ redirect_uris: desktopAppOrigins.map((origin) => urlJoin(origin, '/oidc/callback/toby')),+ response_types: ['code'],+ token_endpoint_auth_method: 'none',+ },{application_type: 'native',client_id: 'lobehub-cli',diff --git a/src/libs/oidc-provider/provider.test.ts b/src/libs/oidc-provider/provider.test.tsindex 701520a556a..3bf33a93bee 100644--- a/src/libs/oidc-provider/provider.test.ts+++ b/src/libs/oidc-provider/provider.test.ts@@ -84,6 +84,32 @@ describe('OIDC Provider - Market Client Integration', () => {vi.doUnmock('@/envs/app');});+ it('should register toby as a public native client with an https callback only', async () => {+ vi.doMock('@/envs/app', () => ({+ appEnv: {+ APP_URL: 'https://app.lobehub.com',+ MARKET_BASE_URL: undefined,+ },+ }));++ const { default: Provider } = await import('oidc-provider');+ const { defaultClients } = await import('./config');+ const provider = new Provider('https://app.lobehub.com/oidc', { clients: defaultClients });+ const tobyClient = await provider.Client.find('toby');++ expect(tobyClient?.applicationType).toBe('native');+ expect(tobyClient?.tokenEndpointAuthMethod).toBe('none');+ expect(tobyClient?.grantTypes).toEqual(['authorization_code', 'refresh_token']);+ expect(tobyClient?.redirectUriAllowed('https://app.lobehub.com/oidc/callback/toby')).toBe(+ true,+ );+ expect(tobyClient?.redirectUriAllowed('https://lobehub.com/oidc/callback/toby')).toBe(true);+ expect(tobyClient?.redirectUriAllowed('com.lobehub.toby://auth/callback')).toBe(false);+ expect(tobyClient?.redirectUriAllowed('https://example.com/oidc/callback/toby')).toBe(false);++ vi.doUnmock('@/envs/app');+ });+it('should export API_AUDIENCE constant', async () => {vi.doMock('@/envs/app', () => ({appEnv: {