Next.js Discord

Discord Forum

Help with Auth

Unanswered
Saltwater Crocodile posted this in #help-forum
Open in Discord
Saltwater CrocodileOP
Hey there, I'm new to nextauth and im building a project, as of now id like few things explained:
1) What is auth() method supposed to return?
2) suppose it returns some sort of json data, how can i get them? do i use the session callback?
im sorry if these things are written on docs, i just might have overlooked them, thanks :)

15 Replies

Saltwater CrocodileOP
but how can i modify the fields inside the session?
@Saltwater Crocodile but how can i modify the fields inside the session?
in the jwt callback on the auth config
Saltwater CrocodileOP
what if im using a database strategy?
that means i dont use jwt right?
it still use
Saltwater CrocodileOP
so if i send custom login request to some endpoint which returns the data if succeed, i can return them in authorize() function, but how do i pass them to the session, or are they automatically?
it will do it for you if you use their signIn function
Saltwater CrocodileOP
so if i use signIn like this:
signIn('credentials', {
          identity,
          password,
        });

is it passed to the auth() afterwards right?
@Ray yes if it signin successfully
Saltwater CrocodileOP
well but what does tell that it signin successfully?
if it redirect you to NEXTAUTH_URL ?
if it finish without causing error?
if the cookies is being set?