Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions packages/shared/src/components/auth/AuthOptionsInner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
} from '../../lib/betterAuth';
import {
getSocialAuthCallbackError,
GITHUB_EMAIL_NOT_VERIFIED_ERROR,
hasSocialAuthBootUser,
refetchSocialAuthBoot,
SOCIAL_AUTH_RETRY_MESSAGE,
Expand Down Expand Up @@ -393,6 +394,10 @@ function AuthOptionsInner({
const callbackError = getSocialAuthCallbackError(e?.data);
const callbackData =
typeof e?.data === 'object' ? JSON.stringify(e.data) : undefined;
const socialErrorMessage =
callbackError === GITHUB_EMAIL_NOT_VERIFIED_ERROR
? labels.auth.error.githubEmailNotVerified
: SOCIAL_AUTH_RETRY_MESSAGE;

let boot;
try {
Expand All @@ -414,7 +419,7 @@ function AuthOptionsInner({
}),
});
if (!authFlowSucceededRef.current) {
displayToast(SOCIAL_AUTH_RETRY_MESSAGE);
displayToast(socialErrorMessage);
}
return;
}
Expand All @@ -436,7 +441,7 @@ function AuthOptionsInner({
}),
});
if (!authFlowSucceededRef.current) {
displayToast(SOCIAL_AUTH_RETRY_MESSAGE);
displayToast(socialErrorMessage);
}
return;
}
Expand Down
2 changes: 2 additions & 0 deletions packages/shared/src/components/auth/socialAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import type { Boot } from '../../lib/boot';
export const SOCIAL_AUTH_RETRY_MESSAGE =
"We couldn't complete your social sign-in. Please try again.";

export const GITHUB_EMAIL_NOT_VERIFIED_ERROR = 'github_email_not_verified';

const SOCIAL_AUTH_BOOT_RETRY_DELAYS_MS = [0, 250, 750] as const;

type BootUser = Partial<Boot>['user'];
Expand Down
2 changes: 2 additions & 0 deletions packages/shared/src/lib/labels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export const labels = {
'❌ We ran into an unexpected error on our end. Please try again.',
existingEmail:
'That email is linked to a different sign-in method. Please try another provider.',
githubEmailNotVerified:
'Your GitHub email address is not verified. Please verify it on GitHub and try again.',
},
},
referral: {
Expand Down
Loading