17 lines
270 B
TypeScript
17 lines
270 B
TypeScript
'use server'
|
|
|
|
import {AuthError} from 'next-auth'
|
|
|
|
import {signIn} from '@/auth'
|
|
|
|
export async function googleAuthenticate() {
|
|
try {
|
|
await signIn('google')
|
|
} catch (error) {
|
|
if (error instanceof AuthError) {
|
|
return 'google log in failed'
|
|
}
|
|
throw error
|
|
}
|
|
}
|