Hi Nader, I followed the tutorial and it works just fine.
I made a change and doesn't work as expected. Instead of using client side for the 1st page after following the magic link I'm using server side as you do in the protected route, the problem is the user always returns null.
My code:
export async function getServerSideProps({ req }) {
const { user } = await supabase.auth.api.getUserByCookie(req);
console.log("user detail:", user);
Hi Nader, I followed the tutorial and it works just fine.
I made a change and doesn't work as expected. Instead of using client side for the 1st page after following the magic link I'm using server side as you do in the protected route, the problem is the user always returns null.
My code:
export async function getServerSideProps({ req }) {
const { user } = await supabase.auth.api.getUserByCookie(req);
console.log("user detail:", user);
if (!user) {
return { props: {}, redirect: { destination: "/login" } };
}
return {
props: {},
};
}
in the last section you'll have to pass user to props:
props: { user }