【发布时间】:2019-08-08 04:14:42
【问题描述】:
我想在我的 graphql 查询中输入令牌。我必须将身份验证令牌放在哪里?
这是我在 apollo.js 中的代码:
import { withData } from 'next-apollo'
import { HttpLink } from 'apollo-link-http'
export const config = {
link: new HttpLink({
uri: 'http://localhost:8000/graphql/', // Server URL (must be absolute)
opts: {
credentials: 'include', // Additional fetch() options like `credentials` or `headers`
}
})
}
export default withData(config)
这就是我进行查询的方式:
const MYJOBS = gql`
{
myJobs {
role {
name
}
school {
name
}
}
}
`
<Query query={MYJOBS}>
【问题讨论】:
标签: reactjs graphql token apollo