You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have set up auth with google in my project and it is working fine. I have set up the middleware and all the createClient functions for server and client. I have the correct auth state in both the server and the client.
But in API route handlers, I get user as null even though I am logged in.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
Start a new Nextjs project.
Follow the docs to implement auth with the ssr package.
Sign in
Call an API endpoint where you call getSession()
Expected behavior
I should get the session info of the current user.
System information
OS: macOS
Browser: Arc
Version of supabase-js: 2.43.5
Version of supabase/ssr: 0.3.0
Version of Node.js: 20.12.2
Additional context
I think the problem is happening because cookies are not being passed to the route handler. But I think they should be passed automatically through the middleware. Why is that not happening?
The text was updated successfully, but these errors were encountered:
@j4w8n Hmmm. It does make sense logically but there should be an easier way to do this instead of manually adding the cookies on each call. Can the middleware not do this?
@j4w8n Hmmm. It does make sense logically but there should be an easier way to do this instead of manually adding the cookies on each call. Can the middleware not do this?
I'm not familiar with Next, I just recall someone having a similar issue in the Discord community.
Bug report
Describe the bug
I have set up auth with google in my project and it is working fine. I have set up the middleware and all the
createClient
functions for server and client. I have the correct auth state in both the server and the client.But in API route handlers, I get user as null even though I am logged in.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
ssr
package.getSession()
Expected behavior
I should get the session info of the current user.
System information
Additional context
I think the problem is happening because cookies are not being passed to the route handler. But I think they should be passed automatically through the middleware. Why is that not happening?
The text was updated successfully, but these errors were encountered: