fixing error in local

This commit is contained in:
Warunee Tamkoo 2024-12-19 11:48:27 +07:00
parent 95dd66eda3
commit a623eee564

11
sso.js
View file

@ -25,7 +25,16 @@ const signOptions = {
const urlKeycloakToken = `${process.env.KC_URL}/realms/${process.env.KC_REALMS}/protocol/openid-connect/token`;
const app = express();
app.use(cors({ origin: '*', methods: 'GET,POST,PUT,DELETE' }));
// Allow a specific origin and enable credentials
const corsOptions = {
origin: 'http://localhost:3002', // Replace with your Vue app's URL
methods: 'GET,POST,PUT,DELETE',
credentials: true, // Enable cookies or Authorization headers
};
app.use(cors(corsOptions));
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
app.use(cookieParser());