Forum Discussion
I recommend installing and using cors in the development node express server like below:
npm install cors
const express = require("express");
const cors = require("cors");
const app = express();
app.use(cors());
Thanks!. I am actually running a React app locally. Haven't built a backend yet. Apologies for not being clear before.
I tried getting the Khoros Access Token from a locally hosted express app and it works fine, majorly because it is not running into the Browser's CORS policy.
Could there be any way to do the same for the React app?
- AmanMalhotra2 years agoExpert
Hi akshays
I don't think you can directly hit API calls from the Localhost React App to the Community APIs, you need to make a server (a simple node or express server) that will run on another port on localhost and there you can HIT API calls and if you want you can trigger those API calls from frontend to your local server and then local server to Khoros APIs.
If you think my comments are helpful, do like my comments!
Related Content
- 3 years ago
- 5 years ago
- 13 years ago