How to get session
Unanswered
American black bear posted this in #help-forum
American black bearOP
Hello, how can i get data session from
/api/auth/session
without spamming the website and the token will changed anytime?20 Replies
Maybe have a look here:
https://auth-docs-git-feat-nextjs-auth-authjs.vercel.app/guides/upgrade-to-v5
https://auth-docs-git-feat-nextjs-auth-authjs.vercel.app/guides/upgrade-to-v5
American black bearOP
the issue is not about this
that the issue
if im trying to use "useSession" that will end the app
like
spamming error
What do you have in [...nextauth]
American black bearOP
route.ts but i fixed by :
But i have other problem when im use "pages" on next-auth to "/login" so i get
callbacks: {
async jwt({ token, account, profile }) {
if (account) {
token.accessToken = account.access_token
token.id = profile.id
}
return token
}
},
But i have other problem when im use "pages" on next-auth to "/login" so i get
'Missing "code_verifier"'
like
pages: {
'signIn': '/login'
}
You are using pages router method?
American black bearOP
App router method
I did this for callbacks:
callbacks: {
async jwt({ token, user }) {
if (user) token.user = user;
return token;
},
async session({ session, token }) {
session.user = token.user;
session.tier = token.tier;
return session
}
},
American black bearOP
im feel so stupid when i was with folder calling "login" so that why that saying "code_verifier"
🤣
American black bearOP
let me fix about the "pages" because im keeping get 404 (i hate this)
this im mean
American black bearOP
@goodsie if im making App router login how im add to link about the state?