swagger-ui - 如何通过 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”获取
谁能告诉我如何通过凭据?我第一次使用招摇。任何人都可以帮忙。我将不胜感激。
解决方案
推荐阅读
- python - 将数组格式的Json数据转换为类型为字典的列表
- excel - 获取定义范围内搜索条件的列号
- wordpress - Wordpress 自动添加标签
- node.js - 如何在 trello Api 中按用户过滤卡片?
- c# - .net core 解析配置界面
- html - Wordpress 图片来源
- c# - 注入一个类来订阅一个内部事件
- python - 为什么我的 apscheduler 没有解雇我的 heroku worker dyno/app/script?
- css - 如何分享可以改变风格的角度库
- docusignapi - 使用 Docusign API 发送信封时,是否可以在文档上有默认签名?