const express = require('express'); const { auth, requiresAuth } = require('express-openid-connect'); const cors = require('cors'); const app = express(); app.use(cors({ origin: 'http://localhost:3000', credentials: true })); const config = { authRequired: false, auth0Logout: true, baseURL: 'http://localhost:3001', clientID: 'H1FcujzHs76LB99W7KcKQOEO9ThtlyLh', issuerBaseURL: 'https://dev-a3o2jif0.us.auth0.com', secret: 'your-secret-key-here' }; app.use(auth(config)); // Protected endpoint for user profile app.get('/api/profile', requiresAuth(), (req, res) => { res.json(req.oidc.user); }); const port = process.env.PORT || 3001; app.listen(port, () => { console.log(`Server running on port ${port}`); });