force login before login with google
This commit is contained in:
@@ -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'>
|
||||
|
||||
Reference in New Issue
Block a user