return fetch(`{SERVICE API URL}`, {
method: 'GET',
headers: {
'userName': "username",
'password': "password",
'content-type': 'application/json'
}
})
.then(response => response.json())
.then(json => dispatch(receivePosts(reddit, json)))
我试图获得与授权头服务API的数据,但得到401 - 未授权错误,并且响应缺少请求头。反应过来+终极版 - 401 - 授权 - 缺少头在请求的头部
尝试与身体发送授权内容也 - 获取相同的错误401 - 未经授权的错误。
编辑:
headers: {
'userName': "xyz",
'sessionToken': "xyz................."
}
当我与邮差客户端检查它工作正常,但不与终极版,传奇取方法。请帮助我。
看起来像在实际代码中的拼写错误..你能证实? –
值得尝试'凭据:'同源''。 –
你有权访问后端代码吗?如果是,那么您使用哪种语言作为后端? –