We have an existing backend - node-express whose rest apis are available. Supertokens was used for a...
u
We have an existing backend - node-express whose rest apis are available. Supertokens was used for auth there. Now we created a nextjs frontend project where we want to consume those APIs. Here we need to use supertokens frontend sdk but for the case of using nextjs as frontend and nodejs as backend I could not find proper flow in your docs. Kindly guide.
r
hey @ubisage you can follow our nextjs guide and ignore all parts related to supertokens-node in there (unless you want to do SSR). For the backend, you can focus on the nestjs guide.
u
should i refer to this section- /emailpassword/nextjs/about ?
r
Yup
u
now i have an error
Access to fetch at 'http://localhost:9002/api/auth/signin' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'.
r
Google cors related issues please
u
cant find a fix for it
also my files are of .js extension
could it cause any error?
r
Not really
u
where the problem would be in frontend or the backend
r
Backend
u
see i am still facing this issue with cors
as backend is cool with respect to cors
also again reminding u that backend is separate not intergrated with next.js,there is nothing in pages/api in next js
so do i need to create some kind of middleware?
r
Not really. CORS issues are easily googleable
u
i cant find one for my case
does next need to send headers to call any path
i am using onclick on login form which calls for signIn function
let me share some pic
for better understanding
this is what happens onClicked
my app js
my config contains only 2 file appInfo.js and frontendConfig.js
is there anything that i am missing?
and also i am sorry for this much of trouble
r
What’s the CORS setting for the backend?
u
to tell u one more time backend is completely separate fronm the frontend in next js