gpt4 book ai didi

meteor - Meteor 的 http.post API 中基本身份验证的参数名称是什么?

转载 作者:行者123 更新时间:2023-12-04 01:24:40 24 4
gpt4 key购买 nike

我在meteor中使用HTTP.post,我需要仅使用用户名向外部服务发送基本身份验证。它会去哪里?那会是什么样子?

我只在服务器端使用它,所以我知道它应该类似于下面的代码,但我不确定在哪里放置用户名以及如何调用它。

我已经尝试过这个。

var resultSet = HTTP.post("https://billy.balancedpayments.com/v1/customers", {
params: {"processor_uri": "/customers/customerURI"},
authentication: {"MYKEYHERE":""}
});

还有这个。

var resultSet = HTTP.post("https://billy.balancedpayments.com/v1/customers", {
params: {"authentication": "MYKEYHERE",
"processor_uri": "/customers/customerURI"}
});

还有这个。

var resultSet = HTTP.post("https://billy.balancedpayments.com/v1/customers", {
params: {"processor_uri": "/customers/customerURI"
},
headers: {'Authorization': 'MYKEYHERE'}
});

我每次都会收到此错误。

Error: failed [403] 403 Forbidden  Access was denied to this resource. 
Unauthorized: CustomerIndexView failed permission check

最佳答案

简单的 auth : 'username:password' 应该做(来自 docs ):

var resultSet = HTTP.post("https://billy.balancedpayments.com/v1/customers", {
params: {"processor_uri": "/customers/customerURI"},
auth: 'yourkey:'
});

根据平衡付款文件:

To authenticate with Balanced, you will need the API key secret provided from the dashboard. You have to use http basic access authentication. Your key has to be set as the username. A password is not required for simplicity.

所以这意味着您将密码留空,因此它只是您的 key 后跟冒号:

此外,您可能需要考虑使用 balanced package对于 Meteor,它会为您完成所有样板文件。

关于meteor - Meteor 的 http.post API 中基本身份验证的参数名称是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24289857/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com