Cookies can only be modified in a Server Action or Route Handler when trying auto sign
Answered
Saltwater Crocodile posted this in #help-forum
Saltwater CrocodileOP
Getting an error on
The doc says to do it through a form, but we don't want a button, we want to guard the whole app and not allow any code to be distributed to the client until login is successfull
if (!session) {
await signIn('identity-server4')The doc says to do it through a form, but we don't want a button, we want to guard the whole app and not allow any code to be distributed to the client until login is successfull
<form action={async () => {
"use server"
await signIn("github")
}}>Answered by Sun bear
Why dont you create a /login page and via middleware redirect all users to that page and use the form here?
1 Reply
Sun bear
Why dont you create a /login page and via middleware redirect all users to that page and use the form here?
Answer