How to get session
Unanswered
American black bear posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
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
![Avatar](https://cdn.discordapp.com/avatars/274685280429015040/a_5916bc81284d155c8ebc1d89cf47d347.gif?size=256)
goodsie
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
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
American black bearOP
the issue is not about this
that the issue
![Image](https://cdn.discordapp.com/attachments/1197263886169157713/1197607864148168804/image.png?ex=65bbe23d&is=65a96d3d&hm=7b9694c15fe8e787d09515096f5e9ec78d6d3b80f34115958285db274c63c3ce&)
if im trying to use "useSession" that will end the app
like
spamming error
![Avatar](https://cdn.discordapp.com/avatars/274685280429015040/a_5916bc81284d155c8ebc1d89cf47d347.gif?size=256)
goodsie
What do you have in [...nextauth]
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
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'
}
![Avatar](https://cdn.discordapp.com/avatars/274685280429015040/a_5916bc81284d155c8ebc1d89cf47d347.gif?size=256)
goodsie
You are using pages router method?
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
American black bearOP
App router method
![Image](https://cdn.discordapp.com/attachments/1197263886169157713/1197637423946010625/image.png?ex=65bbfdc4&is=65a988c4&hm=722fb2e83c494dced01a5b3a92d2e6f3a2dcc48ff3e7af46e1ef175c62c062e6&)
![Avatar](https://cdn.discordapp.com/avatars/274685280429015040/a_5916bc81284d155c8ebc1d89cf47d347.gif?size=256)
goodsie
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
}
},
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
American black bearOP
im feel so stupid when i was with folder calling "login" so that why that saying "code_verifier"
![:lolsob:](https://cdn.discordapp.com/emojis/753870958489632819.png)
![Avatar](https://cdn.discordapp.com/avatars/274685280429015040/a_5916bc81284d155c8ebc1d89cf47d347.gif?size=256)
goodsie
🤣
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
American black bearOP
let me fix about the "pages" because im keeping get 404 (i hate this)
this im mean
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
American black bearOP
@goodsie if im making App router login how im add to link about the state?