Next-Auth "Access Denied" & JWT Sessions
Unanswered
Masai Lion posted this in #help-forum
Masai LionOP
Hey Next-Auth community! This is my first post. I'll try to keep within the community guidelines, but I apologize if I miss some of the finer points.
I have a Next.js app deployed on Vercel. The stack is React (JSX), node and mongo. I'm using Next-Auth for user sign-in with Google as the Provider. I have two issues:
1.) Only SOME of my users will get an "Access Denied" error when trying to sign in with their google accounts. I've tried both marking the Google Project as Internal, and making it External in test mode and directly adding them as approved test users. I've had them clear their cache, double check they're logging in with the right email, ensuring they're logged into the right profile in Chrome, etc. No success.
2.) The JWT session that's created upon sign in is immediately expired, and users will be logged out after a very short idle period. I've attempted to increase the exp property of the session, tried all of the different JWT option configurations I could find online. No success there.
I don't have the logs of my users logging in, because Vercel only tracks them for 1hr, and there isn't a lot of insight in them anyway. I did have the console print the session object after a user logs in, and I've included that screen shot. You can see the exp property is set for a month from now.
I've included screenshots from my /auth/[...nextauth]/route.js file because the message is too long if I paste it in. Thanks in advance for any help!
I have a Next.js app deployed on Vercel. The stack is React (JSX), node and mongo. I'm using Next-Auth for user sign-in with Google as the Provider. I have two issues:
1.) Only SOME of my users will get an "Access Denied" error when trying to sign in with their google accounts. I've tried both marking the Google Project as Internal, and making it External in test mode and directly adding them as approved test users. I've had them clear their cache, double check they're logging in with the right email, ensuring they're logged into the right profile in Chrome, etc. No success.
2.) The JWT session that's created upon sign in is immediately expired, and users will be logged out after a very short idle period. I've attempted to increase the exp property of the session, tried all of the different JWT option configurations I could find online. No success there.
I don't have the logs of my users logging in, because Vercel only tracks them for 1hr, and there isn't a lot of insight in them anyway. I did have the console print the session object after a user logs in, and I've included that screen shot. You can see the exp property is set for a month from now.
I've included screenshots from my /auth/[...nextauth]/route.js file because the message is too long if I paste it in. Thanks in advance for any help!
1 Reply
Only SOME of my usersthose users might have multiple google accounts, log in Chrome browser itself, switching accounts, which could set wrong cookie. just my hunch. occasionally this happens to me, in GCP console login as i have three google accounts.