如何解决如何通过vuejs中的获取请求传递凭据?
我试图通过这样的凭证:
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”的访问权限
有人可以告诉我如何通过凭据吗?我第一次用招摇。谁能帮忙。我将非常感谢。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。