import Head from "next/head"; import { Box, Grid, Container, IconButton } from "@mui/material"; import { Apple as AppleIcon, Google as GoogleIcon } from "@mui/icons-material"; import { signIn, getSession } from "next-auth/react"; const Login = ({ session }) => { const origin = typeof window !== 'undefined' && window.location.origin ? window.location.origin : ''; const buttonStyles = { borderRadius: 500, width: "100%", fontSize: "16px", fontWeight: "bold", }; return ( <> Login {!session ? ( signIn("google", { callbackUrl: `${origin}/auth/sso`, }) } > Google {/* signIn("apple", { callbackUrl: `${window.location.origin}/setup`, }) } > */} ) : null} {session ? ( {` ${session.user.name ?? session.user.email}.`} ) : null} ); }; export default Login; export async function getServerSideProps(context) { const session = (await getSession(context)) ?? null; return { props: { session }, }; }