我在meteor中使用HTTP.post,我需要只使用用户名向外部服务发送基本身份验证.这是怎么回事?看起来会是什么样的?
我只在服务器端使用它,所以我知道它应该看起来像下面的代码,但我不知道在哪里放置用户名和什么叫它.
我试过这个.
var resultSet = HTTP.post("https://billy.balancedpayments.com/v1/customers", {
params: {"processor_uri": "/customers/customerURI"},
authentication: {"MYKEYHERE":""}
});
Run Code Online (Sandbox Code Playgroud)
还有这个.
var resultSet = HTTP.post("https://billy.balancedpayments.com/v1/customers", {
params: {"authentication": "MYKEYHERE",
"processor_uri": "/customers/customerURI"}
});
Run Code Online (Sandbox Code Playgroud)
还有这个.
var resultSet = HTTP.post("https://billy.balancedpayments.com/v1/customers", {
params: {"processor_uri": "/customers/customerURI"
},
headers: {'Authorization': 'MYKEYHERE'}
});
Run Code Online (Sandbox Code Playgroud)
我每次都会收到此错误.
Error: failed [403] 403 Forbidden Access was denied to this resource.
Unauthorized: CustomerIndexView failed permission check
Run Code Online (Sandbox Code Playgroud)
平原auth : 'username:password'应该(从文档):
var resultSet = HTTP.post("https://billy.balancedpayments.com/v1/customers", {
params: {"processor_uri": "/customers/customerURI"},
auth: 'yourkey:'
});
Run Code Online (Sandbox Code Playgroud)
根据平衡付款文件:
要使用Balanced进行身份验证,您需要从仪表板提供API密钥.您必须使用http基本访问身份验证.您的密钥必须设置为用户名.为简单起见,不需要密码.
所以这意味着你把密码留空了,所以它只是你的密钥后跟冒号 :
您也可以考虑使用Meteor 的平衡包,它可以为您完成所有样板.
| 归档时间: |
|
| 查看次数: |
2075 次 |
| 最近记录: |