Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

feat(google): add toast to display error message from google

Amruth Pillai25cf594eb948
diff --git a/client/modals/auth/LoginModal.tsx b/client/modals/auth/LoginModal.tsx
index 8bd70a5da..a9db762bc 100644
--- a/client/modals/auth/LoginModal.tsx
+++ b/client/modals/auth/LoginModal.tsx
@@ -87,16 +87,24 @@ const LoginModal: React.FC = () => {
const handleLoginWithGoogle = async () => {
google.accounts.id.initialize({
+ auto_select: true,
+ itp_support: true,
client_id: env('GOOGLE_CLIENT_ID'),
callback: async (response: any) => {
await loginWithGoogleMutation({ credential: response.credential });
handleClose();
},
- auto_select: false,
});
- google.accounts.id.prompt();
+ google.accounts.id.prompt((notification: any) => {
+ if (notification.isNotDisplayed() || notification.isSkippedMoment()) {
+ const reason = notification.getNotDisplayedReason() || notification.getSkippedReason();
+
+ toast.error(`Google returned an error while trying to sign in: ${reason}.`);
+ toast("Please try logging in using email/password, or use another browser that supports Google's One Tap API.");
+ }
+ });
};
const PasswordVisibility = (): React.ReactElement => {
diff --git a/client/pages/_app.tsx b/client/pages/_app.tsx
index cf4245805..046804ae3 100644
--- a/client/pages/_app.tsx
+++ b/client/pages/_app.tsx
@@ -54,7 +54,7 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
</LocalizationProvider>
</ReduxProvider>
- <Script src="https://accounts.google.com/gsi/client" />
+ <Script src="https://accounts.google.com/gsi/client" async defer />
</>
);
};