Replies: 1 comment 1 reply
-
Some more progress here: It appears that when you call an API route from I also noticed that @iaincollins had a |
Beta Was this translation helpful? Give feedback.
-
Some more progress here: It appears that when you call an API route from I also noticed that @iaincollins had a |
Beta Was this translation helpful? Give feedback.
-
Question 💬
In short, when securing an API route with getSession, any time a page attempts to fetch from the API, getSession returns null but if I go to the API link directly, it works as expected.
To test this, I have a test API route at the path
pages/api/test.js
that callsgetSession({ req })
and returns True if a session is found, False if it isn't.I also have a basic Page component at
pages/test/index.js
. ViagetServerSideProps
, I fetch a response from the API and pass the response as a prop to the Page component. Every time, regardless if I'm signed in or not, the response from the test route is{valid: false}
.However, if I point my browser to
localhost:3000/api/test
, I receive the expected response. Any help here would be appreciated! I'm using Google Sign In with my own MySQL database.How to reproduce ☕️
No response
Contributing 🙌🏽
Yes, I am willing to help answer this question in a PR
Beta Was this translation helpful? Give feedback.
All reactions