【发布时间】:2018-04-16 16:39:16
【问题描述】:
我已尝试按照 Apollo 客户端上的说明发送 cookie 以及 graphql 请求,但快递服务器没有收到任何 cookie,当我检查请求时,它显示响应中没有发送任何 cookie。
关注此页面:
https://www.apollographql.com/docs/react/recipes/authentication.html
我的代码是
const link = createHttpLink({
uri: 'http://localhost:3000/api/graphql',
opts: {
credentials: 'include',
}
});
const client = new ApolloClient({
link,
cache: new InMemoryCache()
});
我的设置很简单,我只是在 localhost:3000 上使用 create-react-app 服务器,将 api 请求发送到 localhost:5000(快速 api 服务器)。我可以通过 localhost:3000 在其他路由上设置和检索 cookie,只有 Apollo Client 不发送它们。
【问题讨论】:
标签: express cookies react-apollo