Redirect to provider's signin page in getServerSideProps #1203
Unanswered
cascandaliato
asked this question in
Help
Replies: 1 comment 1 reply
-
You could try doing something similar to this export const getServerSideProps = async ({ req }) => {
const session = await getSession({ req })
if (!session) {
return {
props: {},
redirect: {
destination: '/path/to/redirect',
permanent: false
}
}
}
return {
props: {
session
}
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Client side, I can do
to redirect an unauthenticated user directly to the provider's page, bypassing the built-in
/auth/signin
page.How do I achieve the same result in
getServerSideProps
?I tried with
but it brings me to the built-in page
Beta Was this translation helpful? Give feedback.
All reactions