#Help with next auth [SOLVED]

19 messages · Page 1 of 1 (latest)

covert schooner
#

my problem is: i have this app, it was running just fine on production, it was like 1 month since my last commit on the project (just saying that to specify that it was working just fine).
the problem is: i do the login normally, it redirects to /home page. on the home page im trying to go to the /members page
there i have

const session = await getSession(context)

  if (!session) {
    return {
      redirect: {
        destination: '/login',
        permanent: false
      }
    }
  }

the problem is on this session, i'm getting NULL on it, so redirect to /login again.
yes i have checked on cookis already and my session/token is on there..

unique flame
#

Are you getting an error back when authenticating?

covert schooner
#

i'm getting redirect when i go to /member

#

redirects to /login because session is null

#

but, only happening on production

#

it was working

unique flame
#

that sounds like expected behavior? If you're not logged in, redirect to the login page

covert schooner
#

but i'm logged

#

i do the login, redirects to /home, this is the behavior. but on the /home im trying to go to /members

#

and i have a getServersideProps, with the code that i showed up there

#

i dont know why the getsession is null because i do have session. on /home i have displayed the firt_name and last_name of the user, i have stuff on cookies too

unique flame
covert schooner
#

ok, but how does works on local?

#

o-o

unique flame
#

Some things in dev mode will render on the client

#

I don't know if there's a specific guide to what and where, but that would be my guess

covert schooner
#

humm

#

solved with getServerSession

#

thanks!