Skip to content

Commit 965a4cb

Browse files
authored
fix(clerk-js): Show primary email or phone number in OAuth consent screen (#7797)
1 parent ea9a038 commit 965a4cb

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

.changeset/fast-paws-double.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@clerk/clerk-js": patch
3+
---
4+
5+
Fixed an issue where primary identifier shows undefined when signing in with phone number only

packages/clerk-js/src/ui/components/OAuthConsent/OAuthConsent.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function OAuthConsentInternal() {
2525
const { applicationName, logoImageUrl } = useEnvironment().displayConfig;
2626
const [isUriModalOpen, setIsUriModalOpen] = useState(false);
2727

28-
const primaryEmailAddress = user?.emailAddresses.find(email => email.id === user.primaryEmailAddress?.id);
28+
const primaryIdentifier = user?.primaryEmailAddress?.emailAddress || user?.primaryPhoneNumber?.phoneNumber;
2929

3030
// Filter out offline_access from displayed scopes as it doesn't describe what can be accessed
3131
const displayedScopes = (scopes || []).filter(item => item.scope !== OFFLINE_ACCESS_SCOPE);
@@ -106,9 +106,7 @@ export function OAuthConsentInternal() {
106106
</ConnectionHeader>
107107
)}
108108
<Header.Title localizationKey={oAuthApplicationName} />
109-
<Header.Subtitle
110-
localizationKey={`wants to access ${applicationName} on behalf of ${primaryEmailAddress}`}
111-
/>
109+
<Header.Subtitle localizationKey={`wants to access ${applicationName} on behalf of ${primaryIdentifier}`} />
112110
</Header.Root>
113111
<Box
114112
sx={t => ({

0 commit comments

Comments
 (0)