getting this error in the console on the client si...
# support-questions-legacy
b
getting this error in the console on the client side Access to fetch at 'https://api-development.bitcoinerfreelance.com/auth/session/refresh' from origin 'https://development.bitcoinerfreelance.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. Here is my Cors implementation on the back end app.use( cors({ origin: websiteDomain, allowedHeaders: ["content-type", ...supertokens.getAllCORSHeaders()], methods: ["GET", "PUT", "POST", "DELETE"], credentials: true, }) ); and my Supertokens init supertokens.init({ framework: "express", supertokens: { // TODO AARON - in production need to swap this with the connection for supertokens connectionURI: configData.superTokens.connectionURI, apiKey: configData.superTokens.apiKey, }, appInfo: { appName: "Bitcoiner Freelance", apiDomain: apiDomain, websiteDomain: websiteDomain, apiBasePath: "/auth", websiteBasePath: "/auth", },
r
hey @bitcoinrippin which API are you calling when this error happens?
b
im trying to connect to my own API
to be honest, rp, the more i look into this the more I am unsure that it is a supertokens issue
It could easily end up being an issue with my server.
r
this is definitely not a supertokens issue
but you want to make sure that the cors middleware is applied before the supertokesn middleware
and you want to make sure that the value of the cors origin is set correctly.
b
yep I have verified all of the above
thanks for being a sounding board!
3 Views