我试图通过这样的凭证:
fetch(this.url + '/auth/login', {method:'GET',
headers: {'Authorization': 'Basic ' + btoa('xxxx:xxxx')}})
.then(response => response.json())
.then(json => console.log(json));
但是它在控制台中给出了此错误:
GET https://stagingapi.pikflick.com/auth/login 404 (Not Found)
我尝试了另一种方式:
fetch(this.url + "/auth/login", {
method: 'GET',
credentials: 'include',
redirect: 'follow',
agent: null,
headers: {
"Content-Type": "text/plain",
'Authorization': 'Basic ' + btoa('xxxx:xxxx'),
}
});
它显示此错误:
CORS策略阻止从来源“ http:// localhost:8080”访问“ https://stagingapi.pikflick.com/auth/login”的访问权限
有人可以告诉我如何通过凭据吗?我第一次用招摇。谁能帮忙。我将非常感谢。