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................."
}
當我與郵差客戶端檢查它工作正常,但不與終極版,傳奇取方法。請幫助我。
看起來像在實際代碼中的拼寫錯誤..你能證實? –
值得嘗試'憑據:'同源''。 –
你有權訪問後端代碼嗎?如果是,那麼您使用哪種語言作爲後端? –