force login before login with google

This commit is contained in:
Mo Tarbin
2026-07-16 18:52:05 -04:00
parent 96cee7e5c2
commit 46b1902af2

View File

@@ -699,14 +699,27 @@ const LoginView = () => {
variant='soft'
size='lg'
sx={{ mt: 3, mb: 2 }}
onClick={() => {
SocialLogin.login({
onClick={async () => {
try {
// Clear any cached session so the account picker shows
await SocialLogin.logout({ provider: 'google' }).catch(
() => {},
)
const user = await SocialLogin.login({
provider: 'google',
options: { scopes: ['profile', 'email', 'openid'] },
}).then(user => {
})
console.log('Google user', user)
loggedWithProvider('google', user.result)
} catch (error) {
console.error('Google login error:', error)
showError({
title: 'Google Login Failed',
message: `Couldn't log in with Google, please try again${
error?.message ? `: ${error.message}` : ''
}`,
})
}
}}
>
<div className='flex gap-2'>