How to set include cookie in apollo studio sandbox

I created my server to use authentication with cookies. And when I try to include cookies in the apollo sandbox setting, The browser console log the following errors.

Access to fetch at 'http://localhost:4050/graphql' from origin 'https://studio.apollographql.com' has been blocked by CORS policy: 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'.

I use apollo-server-express and here is my cors option.

const corsOptions = {
  origin: "https://studio.apollographql.com",
  credentials: true,  
}
const app = express()
app.use(cookieParser());

app.use(cors(corsOptions))

I don’t know how to solve this problem. It seems like I have presented my server response as

Access-Control-Allow-Origin: https://studio.apollographql.com
Access-Control-Allow-Credentials: true

to the Studio but why it always giving the errors.

Thank you in advance

1 Like

Hi there :wave:

Could you please check the network tab to see if responses from the server do in fact contain the headers?

My guess is the configuration didn’t take effect for some reason

Wonder if you could push to a repo, I wouldn’t mind pulling and poking :slight_smile: