NextJs SSR `withPageAuth` from `supabaseauth-helpers-nextjs` doesn't pick up the authenticated user
This is a NextJs project.
If I have this button handler code on my SignIn page:
}
)
redirectTo: '/auth/sign_in_or_create_account',
async getServerSideProps(ctx) {
const { user } = await getUser(ctx)
return { props: { user: user } }
},
})
How does the server side page can 'know' that the user already clicked the magic link from the email?
If I have this button handler code on my SignIn page:
const { error } = await supabase.auth.signIn(
{ email },
{
redirectTo: http://localhost:3000/user/asd`,}
)
Then I click on my email the 'magic link', and then
When my protected page pages/user/[id].js attempts to get the already authenticated user with this
export const getServerSideProps = withPageAuth({redirectTo: '/auth/sign_in_or_create_account',
async getServerSideProps(ctx) {
const { user } = await getUser(ctx)
return { props: { user: user } }
},
})
I'm redirected back to login page when I should stay at /user/[id]` route.How does the server side page can 'know' that the user already clicked the magic link from the email?