Help with Auth
Unanswered
Saltwater Crocodile posted this in #help-forum
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
im sorry if these things are written on docs, i just might have overlooked them, thanks :)
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 Crocodile 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 :)
it return a session
export interface DefaultSession {
user?: {
name?: string | null
email?: string | null
image?: string | null
}
expires: ISODateString
}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?
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 functionSaltwater CrocodileOP
so if i use signIn like this:
is it passed to the auth() afterwards right?
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?