diff --git a/hooks/useUser.ts b/hooks/useUser.ts index 6106f2e0..c27105ac 100644 --- a/hooks/useUser.ts +++ b/hooks/useUser.ts @@ -431,7 +431,7 @@ const useUser = (): UseUserReturn => { ? 'User not found, please sign up' : error?.message || 'Network request timed out'; - if (error?.name === 'NotAllowedError') { + if (error?.name === 'NotAllowedError' || isPasskeyPromptError(error)) { errorMessage = 'User cancelled login'; Sentry.captureMessage(errorMessage, { level: 'warning', diff --git a/lib/utils/__tests__/passkey-credentials.test.ts b/lib/utils/__tests__/passkey-credentials.test.ts index 31c9f5a6..fcbb1416 100644 --- a/lib/utils/__tests__/passkey-credentials.test.ts +++ b/lib/utils/__tests__/passkey-credentials.test.ts @@ -59,6 +59,7 @@ describe('mergeCredentialIds', () => { describe('isPasskeyPromptError', () => { it.each([ ['iOS cancellation', { message: 'The user cancelled the request.' }], + ['Turnkey UserCancelled', { error: 'UserCancelled', message: 'The user cancelled the request.' }], ['Android Credential Manager', { message: '[16] Cancelled by user.' }], ['WebAuthn DOMException', { name: 'NotAllowedError', message: 'not allowed' }], ['aborted ceremony', { name: 'AbortError', message: 'aborted' }],