aquaspirit
02/17/2022, 10:35 PMjs
const handleGoogleAuth = () => {
supabase.auth.signIn(
{
provider: 'google',
},
{
redirectTo: 'https://foo.com/dashboard',
},
);
};
// ...
button.onclick = handleGoogleAuth // fire signIn
// ... route to Dashboard
// Dashboard page
const Dashboard () => {
return <div><h1>Dashboard</h1></div>
}
export const getServerSideProps: GetServerSideProps = async ({ query, req }) => {
// req.cookie is empty object
const { user, token } = await supabase.auth.api.getUserByCookie(req);
// user and token are null, but that's because req.cookie is empty object
return {
props: {},
};
};
export default Dashboard
silentworks
02/18/2022, 10:26 AM