Skip to content

feat(clerk-js,clerk-react,nextjs): Introduce <APIKeys /> AIO component #5858

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 136 commits into from
Jun 13, 2025

Conversation

wobsoriano
Copy link
Member

@wobsoriano wobsoriano commented May 6, 2025

Description

  • Introduce <APIKeys /> AIO component (early access)
  • Introduce Clerk.apiKeys module, which contains methods to create, revoke and get api key secrets.
  • Adds a new API Keys page in the <UserProfile /> and <OrganizationProfile /> components.

Note:

  • We are not yet doing GA, only for early access partners
  • Test to follow in a separate PR
  • Element descriptors in a separate PR

Resolves ROBO-20

Screen.Recording.2025-06-09.at.7.00.12.PM.mov

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced early-access "API Keys" management UI for user and organization profiles with creation, viewing, copying, searching, pagination, and revocation capabilities.
    • Added dedicated navigation routes and pages for API key management in user and organization profiles.
    • Included confirmation modals for API key revocation.
    • Added localization support for API key management UI in English and German.
    • Introduced React components and hooks for API key listing, creation, revocation, and secret display.
    • Added Clerk SDK support for mounting/unmounting API Keys UI component and API key operations.
  • Enhancements

    • Improved theming and appearance customization for the API Keys component.
    • Updated navigation components and context providers to support new API Keys routes and modal integrations.
    • Added portal root support for modals and popovers to improve UI rendering flexibility.
    • Enhanced navbar context to pass content references for modal anchoring.
    • Added new icons for API Keys UI.
  • Documentation

    • Extended type definitions, component props, and localization resources to support API Keys features.
    • Added experimental API Keys types and namespace to SDK typings.
  • Tests

    • Added tests covering API key settings initialization and serialization in environment resources.

Copy link

changeset-bot bot commented May 6, 2025

🦋 Changeset detected

Latest commit: b1e175c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 22 packages
Name Type
@clerk/localizations Patch
@clerk/types Patch
@clerk/clerk-js Minor
@clerk/nextjs Minor
@clerk/clerk-react Minor
@clerk/agent-toolkit Patch
@clerk/astro Patch
@clerk/backend Patch
@clerk/elements Patch
@clerk/expo-passkeys Patch
@clerk/clerk-expo Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/remix Patch
@clerk/shared Patch
@clerk/tanstack-react-start Patch
@clerk/testing Patch
@clerk/themes Patch
@clerk/vue Patch
@clerk/chrome-extension Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented May 6, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
clerk-js-sandbox ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 13, 2025 8:18pm

@panteliselef
Copy link
Member

Are we launching with this immediately? Are we doing any private or public betas ?

@wobsoriano wobsoriano closed this May 6, 2025
@wobsoriano
Copy link
Member Author

wobsoriano commented May 6, 2025

Are we launching with this immediately? Are we doing any private or public betas ?

We have an early access program for machine auth currently and I think we'll just be using this PR for snapshots for now

}

export interface APIKeysSettingsResource extends ClerkResource {
enabled: boolean;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not just for the beta period, right ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is already in prod

Comment on lines +133 to +150
<SegmentedControl.Button
value='never'
text='Never'
/>
<SegmentedControl.Button
value='30d'
text='30 days'
/>
<SegmentedControl.Button
value='90d'
text='90 days'
/>
<SegmentedControl.Button
value='custom'
text='Custom'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Localization still missing here

variant='caption'
colorScheme='secondary'
>
Created at{' '}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto localization

colorScheme='secondary'
>
Created at{' '}
{apiKey.createdAt.toLocaleDateString(undefined, {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use localization with our date modifiers.

const { user } = useUser();
const { organization } = useOrganization();

const subject = organization?.id ?? user?.id ?? '';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean from dashboard you can only turn on the feature for either orgs or users but not at the same time ?

Copy link
Member Author

@wobsoriano wobsoriano Jun 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, this is for the standalone <APIKeys /> component. If an org is active, we use that instead of the current user. For UserProfile page, we use the user id and vice versa.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the developer be able to choose the subject when they mount <APIKeys /> like <APIKeys for="orgs" />

Copy link
Member Author

@wobsoriano wobsoriano Jun 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally we allowed it, but Bryce pointed out that all of our components defaults to org or user session and does not accept a custom prop and we'd want to keep the behavior here

@wobsoriano wobsoriano enabled auto-merge (squash) June 13, 2025 20:31
@wobsoriano wobsoriano merged commit 18bcb64 into main Jun 13, 2025
85 of 87 checks passed
@wobsoriano wobsoriano deleted the rob/robo-20-manage-api-keys branch June 13, 2025 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants