-
Notifications
You must be signed in to change notification settings - Fork 419
feat(clerk-js): Hide passkeys section when enterprise account disables additional identifications #6585
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
LauraBeatris
merged 3 commits into
main
from
nicolas/fix-passkeys-with-disable-additional-identifiers
Aug 20, 2025
Merged
feat(clerk-js): Hide passkeys section when enterprise account disables additional identifications #6585
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@clerk/clerk-js': patch | ||
| --- | ||
|
|
||
| Hide passkeys section when user has an enterprise account with the disable additional identifiers setting enabled | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,7 +70,6 @@ describe('SecurityPage', () => { | |
| last_used_at: Date.now(), | ||
| verification: null, | ||
| updated_at: Date.now(), | ||
| credential_id: 'some_id', | ||
| }, | ||
| ], | ||
| }); | ||
|
|
@@ -85,6 +84,195 @@ describe('SecurityPage', () => { | |
| getByText(/^Last used:/); | ||
| }); | ||
|
|
||
| describe('Passkeys section visibility', () => { | ||
| describe('with active enterprise connection', () => { | ||
| it('shows the passkeys section when passkeys are enabled', async () => { | ||
| const { wrapper, fixtures } = await createFixtures(f => { | ||
| f.withEmailAddress(); | ||
| f.withEnterpriseSso(); | ||
| f.withPasskey(); | ||
| f.withUser({ | ||
| email_addresses: ['[email protected]'], | ||
| passkeys: [ | ||
| { | ||
| object: 'passkey', | ||
| id: '1234', | ||
| name: 'Chrome on Mac', | ||
| created_at: Date.now(), | ||
| last_used_at: Date.now(), | ||
| verification: null, | ||
| updated_at: Date.now(), | ||
| }, | ||
| ], | ||
| enterprise_accounts: [ | ||
| { | ||
| object: 'enterprise_account', | ||
| active: true, | ||
| first_name: 'Laura', | ||
| last_name: 'Serafim', | ||
| protocol: 'saml', | ||
| provider_user_id: null, | ||
| public_metadata: {}, | ||
| email_address: '[email protected]', | ||
| provider: 'saml_okta', | ||
| enterprise_connection: { | ||
| object: 'enterprise_connection', | ||
| provider: 'saml_okta', | ||
| name: 'Okta Workforce', | ||
| id: 'ent_123', | ||
| active: true, | ||
| allow_idp_initiated: false, | ||
| allow_subdomains: false, | ||
| disable_additional_identifications: false, | ||
| sync_user_attributes: false, | ||
| domain: 'foocorp.com', | ||
| created_at: 123, | ||
| updated_at: 123, | ||
| logo_public_url: null, | ||
| protocol: 'saml', | ||
| }, | ||
| verification: { | ||
| status: 'verified', | ||
| strategy: 'saml', | ||
| verified_at_client: 'foo', | ||
| attempts: 0, | ||
| error: { | ||
| code: 'identifier_already_signed_in', | ||
| long_message: "You're already signed in", | ||
| message: "You're already signed in", | ||
| }, | ||
| expire_at: 123, | ||
| id: 'ver_123', | ||
| object: 'verification', | ||
| }, | ||
| id: 'eac_123', | ||
| }, | ||
| ], | ||
| }); | ||
| }); | ||
| fixtures.clerk.user?.getSessions.mockReturnValue(Promise.resolve([])); | ||
|
|
||
| render(<SecurityPage />, { wrapper }); | ||
| await waitFor(() => expect(fixtures.clerk.user?.getSessions).toHaveBeenCalled()); | ||
| screen.getByText('Passkeys'); | ||
| screen.getByText('Chrome on Mac'); | ||
| }); | ||
|
|
||
| it('hides the passkeys section when disable_additional_identifications is true', async () => { | ||
| const { wrapper, fixtures } = await createFixtures(f => { | ||
| f.withEmailAddress(); | ||
| f.withEnterpriseSso(); | ||
| f.withPasskey(); | ||
| f.withUser({ | ||
| email_addresses: ['[email protected]'], | ||
| passkeys: [ | ||
| { | ||
| object: 'passkey', | ||
| id: '1234', | ||
| name: 'Chrome on Mac', | ||
| created_at: Date.now(), | ||
| last_used_at: Date.now(), | ||
| verification: null, | ||
| updated_at: Date.now(), | ||
| }, | ||
| ], | ||
| enterprise_accounts: [ | ||
| { | ||
| object: 'enterprise_account', | ||
| active: true, | ||
| first_name: 'Laura', | ||
| last_name: 'Serafim', | ||
| protocol: 'saml', | ||
| provider_user_id: null, | ||
| public_metadata: {}, | ||
| email_address: '[email protected]', | ||
| provider: 'saml_okta', | ||
| enterprise_connection: { | ||
| object: 'enterprise_connection', | ||
| provider: 'saml_okta', | ||
| name: 'Okta Workforce', | ||
| id: 'ent_123', | ||
| active: true, | ||
| allow_idp_initiated: false, | ||
| allow_subdomains: false, | ||
| disable_additional_identifications: true, | ||
| sync_user_attributes: false, | ||
| domain: 'foocorp.com', | ||
| created_at: 123, | ||
| updated_at: 123, | ||
| logo_public_url: null, | ||
| protocol: 'saml', | ||
| }, | ||
| verification: { | ||
| status: 'verified', | ||
| strategy: 'saml', | ||
| verified_at_client: 'foo', | ||
| attempts: 0, | ||
| error: { | ||
| code: 'identifier_already_signed_in', | ||
| long_message: "You're already signed in", | ||
| message: "You're already signed in", | ||
| }, | ||
| expire_at: 123, | ||
| id: 'ver_123', | ||
| object: 'verification', | ||
| }, | ||
| id: 'eac_123', | ||
| }, | ||
| ], | ||
| }); | ||
| }); | ||
| fixtures.clerk.user?.getSessions.mockReturnValue(Promise.resolve([])); | ||
|
|
||
| render(<SecurityPage />, { wrapper }); | ||
| await waitFor(() => expect(fixtures.clerk.user?.getSessions).toHaveBeenCalled()); | ||
| expect(screen.queryByText('Passkeys')).not.toBeInTheDocument(); | ||
| expect(screen.queryByText('Chrome on Mac')).not.toBeInTheDocument(); | ||
| }); | ||
| }); | ||
|
|
||
| describe('without enterprise connection', () => { | ||
| it('shows the passkeys section when passkeys are enabled', async () => { | ||
| const { wrapper, fixtures } = await createFixtures(f => { | ||
| f.withPasskey(); | ||
| f.withUser({ | ||
| email_addresses: ['[email protected]'], | ||
| passkeys: [ | ||
| { | ||
| object: 'passkey', | ||
| id: '1234', | ||
| name: 'Chrome on Mac', | ||
| created_at: Date.now(), | ||
| last_used_at: Date.now(), | ||
| verification: null, | ||
| updated_at: Date.now(), | ||
| }, | ||
| ], | ||
| }); | ||
| }); | ||
| fixtures.clerk.user?.getSessions.mockReturnValue(Promise.resolve([])); | ||
|
|
||
| render(<SecurityPage />, { wrapper }); | ||
| await waitFor(() => expect(fixtures.clerk.user?.getSessions).toHaveBeenCalled()); | ||
| screen.getByText('Passkeys'); | ||
| screen.getByText('Chrome on Mac'); | ||
| }); | ||
|
|
||
| it('hides the passkeys section when passkeys are not enabled', async () => { | ||
| const { wrapper, fixtures } = await createFixtures(f => { | ||
| f.withUser({ | ||
| email_addresses: ['[email protected]'], | ||
| }); | ||
| }); | ||
| fixtures.clerk.user?.getSessions.mockReturnValue(Promise.resolve([])); | ||
|
|
||
| render(<SecurityPage />, { wrapper }); | ||
| await waitFor(() => expect(fixtures.clerk.user?.getSessions).toHaveBeenCalled()); | ||
| expect(screen.queryByText('Passkeys')).not.toBeInTheDocument(); | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| it('shows the active devices of the user and has appropriate buttons', async () => { | ||
| const { wrapper, fixtures } = await createFixtures(f => { | ||
| f.withSocialProvider({ provider: 'google' }); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Double-check release type (patch vs. minor/major) given public surface changes.
If this PR only gates visibility and doesn’t change public types/APIs, “patch” is fine. If
UserProfileContextTypegained a new exported field or public Passkey types changed (e.g.,credential_idremoval), consider “minor” or “major” depending on breakage. Please verify.Run this script to spot potential public-facing changes and usages that might warrant a higher bump:
🏁 Script executed:
Length of output: 5925
Bump @clerk/clerk-js to minor
The new
shouldAllowIdentificationCreationfield was added to the exportedUserProfileContextType, which expands the public API in a backwards-compatible way. This requires a minor version bump, not a patch.• File: .changeset/rotten-baths-wish.md
– Change line 2 from
'@clerk/clerk-js': patchto
'@clerk/clerk-js': minor🤖 Prompt for AI Agents