
Are you able to see the network request details

this?

No the account.get() call

Is it the last session cookie that came from Appwrite?

it gets called on page load by the middleware. so can't specify it from the console

what do u mean by the last session cookie?

The last time you created the email session.

maybe i'm too noob to understand what u saying. do u want me to remove the middleware code and do a successful login, and then again add the middleware code and then compare the before and after cookie values?

Sure that could work.
Or you can manually try to use that cookie value to make the request

yoo... they aren't same😐

That's not good. Maybe the value in your middleware is an old deleted session and that's why you're getting the error

sad... how can i solve this?

Are you making sure to clear things as necessary?

clear things as necessary? didn't get it

For example, deleting the cookie if it's not valid anymore

i'm deleting the cookies only when the user logs out. do i need to do anything more?

Maybe it's not getting deleted in all places or something. I don't know. I hate nextjs

after some digging, i found that when the middleware is on, we are not setting any new cookie value. till now what i was seeing was the cookie from the last session

Again...I hate nextjs 🤣

and after your suggestion on another post of mine, i handled the cookies manually in the /auth/oauth2/success
path

that means my middleware is redirecting it from /auth/oauth2/success
to /
before the code of /auth/oauth2/success
gets executed

okay, so I just found out I'm nothing but dumb. i had to add /auth/oauth2/success
as a public route in the middleware

don't hate nextjs. hate me🙂

[SOLVED] user session is created, but currentUser
still returns null

Still hate nextjs because of all these gotchas 😜 I'm glad you figured it out <:appwriteparty:946072712915341333>
Recommended threads
- DNS help
I need the appwrite console in api.xxxxxxx.com and a next.js website in xxxxxxx.com how can i achive this
- Appwrite sites domain not updating
Whenever I commit and sync changes to my github repo which has my website. If i try to go to the domain that was given to me "https://nameofwebsite.appwrite.net...
- Sites - ETA
Hi I've requested Sites and I am currently on waiting list. Whats average ETA to be this available from requesting it? I am on Free tier atm.
