Skip to content
Draft
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
6 changes: 6 additions & 0 deletions .changeset/world-id-provider.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@clerk/shared': minor
'@clerk/ui': patch
---

Add support for the `oauth_world_id` sign-in strategy. Instances with a World ID connection enabled can display World ID alongside their existing social connections.
6 changes: 6 additions & 0 deletions packages/shared/src/oauth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,12 @@ export const OAUTH_PROVIDERS: OAuthProviderData[] = [
name: 'AgentID',
docsUrl: 'https://clerk.com/docs/guides/configure/auth-strategies/social-connections/agentid',
},
{
provider: 'world_id',
strategy: 'oauth_world_id',
name: 'World ID',
docsUrl: 'https://clerk.com/docs/guides/configure/auth-strategies/social-connections/world-id',
},
];

interface getOAuthProviderDataProps {
Expand Down
3 changes: 3 additions & 0 deletions packages/shared/src/types/oauth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ export type VercelOauthProvider = 'vercel';
/** @inline */
export type AgentIDOauthProvider = 'agentid';
/** @inline */
export type WorldIDOauthProvider = 'world_id';
/** @inline */
export type CustomOauthProvider = `custom_${string}`;

/** Represents the available OAuth providers. */
Expand Down Expand Up @@ -104,4 +106,5 @@ export type OAuthProvider =
| HuggingfaceOAuthProvider
| VercelOauthProvider
| AgentIDOauthProvider
| WorldIDOauthProvider
| CustomOauthProvider;
6 changes: 6 additions & 0 deletions packages/shared/src/types/runtime-values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@ export const OAUTH_PROVIDERS: OAuthProviderData[] = [
name: 'AgentID',
docsUrl: 'https://clerk.com/docs/guides/configure/auth-strategies/social-connections/agentid',
},
{
provider: 'world_id',
strategy: 'oauth_world_id',
name: 'World ID',
docsUrl: 'https://clerk.com/docs/guides/configure/auth-strategies/social-connections/world-id',
},
];

/**
Expand Down
15 changes: 8 additions & 7 deletions packages/ui/src/common/__tests__/ProviderIcon.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,24 +68,25 @@ describe('ProviderIcon', () => {
expect(styles.backgroundImage).not.toContain(iconUrl);
});

it('applies background-image styles for non-mask-image providers', async () => {
it.each(['google', 'world_id'] as const)('preserves the original colors for provider %s', async id => {
const { wrapper } = await createFixtures();
const iconUrl = `https://example.com/${id}-icon.svg`;

render(
<ProviderIcon
id='google'
iconUrl='https://example.com/google-icon.svg'
name='Google'
id={id}
iconUrl={iconUrl}
name={id}
/>,
{ wrapper },
);

const icon = screen.getByLabelText('Google icon');
const icon = screen.getByLabelText(`${id} icon`);
expect(icon).toBeInTheDocument();

const styles = window.getComputedStyle(icon);
expect(styles.backgroundImage).toContain('https://example.com/google-icon.svg');
expect(styles.maskImage).not.toContain('https://example.com/google-icon.svg');
expect(styles.backgroundImage).toContain(iconUrl);
expect(styles.maskImage).not.toContain(iconUrl);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ describe('useEnabledThirdPartyProviders', () => {
'oauth_twitch',
'oauth_twitter',
'oauth_vercel',
'oauth_world_id',
'oauth_x',
'oauth_xero',
]);
Expand Down