diff --git a/.changeset/fast-paws-double.md b/.changeset/fast-paws-double.md new file mode 100644 index 00000000000..43b775ab514 --- /dev/null +++ b/.changeset/fast-paws-double.md @@ -0,0 +1,5 @@ +--- +"@clerk/clerk-js": patch +--- + +Fixed an issue where primary identifier shows undefined when signing in with phone number only diff --git a/packages/clerk-js/src/ui/components/OAuthConsent/OAuthConsent.tsx b/packages/clerk-js/src/ui/components/OAuthConsent/OAuthConsent.tsx index 8555248176f..1ad15bbfaf0 100644 --- a/packages/clerk-js/src/ui/components/OAuthConsent/OAuthConsent.tsx +++ b/packages/clerk-js/src/ui/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() { )} - + ({