diff --git a/.changeset/thin-camels-refuse.md b/.changeset/thin-camels-refuse.md new file mode 100644 index 00000000000..1d1570ccb56 --- /dev/null +++ b/.changeset/thin-camels-refuse.md @@ -0,0 +1,5 @@ +--- +"@clerk/ui": patch +--- + +Fixed an issue where primary identifier in OAuth consent screen shows undefined when signing in with phone number only diff --git a/packages/ui/src/components/OAuthConsent/OAuthConsent.tsx b/packages/ui/src/components/OAuthConsent/OAuthConsent.tsx index 8555248176f..1ad15bbfaf0 100644 --- a/packages/ui/src/components/OAuthConsent/OAuthConsent.tsx +++ b/packages/ui/src/components/OAuthConsent/OAuthConsent.tsx @@ -25,7 +25,7 @@ export function OAuthConsentInternal() { const { applicationName, logoImageUrl } = useEnvironment().displayConfig; const [isUriModalOpen, setIsUriModalOpen] = useState(false); - const primaryEmailAddress = user?.emailAddresses.find(email => email.id === user.primaryEmailAddress?.id); + const primaryIdentifier = user?.primaryEmailAddress?.emailAddress || user?.primaryPhoneNumber?.phoneNumber; // Filter out offline_access from displayed scopes as it doesn't describe what can be accessed const displayedScopes = (scopes || []).filter(item => item.scope !== OFFLINE_ACCESS_SCOPE); @@ -106,9 +106,7 @@ export function OAuthConsentInternal() { )} - + ({