我想使用 Publons 的 API。他们提到了"Any other requests should include a token in the Authorization HTTP header and prefixed with 'Token'.
所以,我尝试设置Token
in 标题。这是我的代码
$client = new Client([
'base_uri' => "https://publons.com/api/v2/academic/",
'headers' => [
'Token' => "MyToken"
]
]);
结果是{"detail":"Authentication credentials were not provided."}
。我确保令牌是正确的,因为我已经在 Talend API Tester 上尝试过并且有效。谁能帮我?错误在哪里?
只是猜测,他们的文档中没有太多内容,但我想它看起来像这样:
$client = new Client([
'base_uri' => "https://publons.com/api/v2/academic/",
'headers' => [
'Authorization' => "Token{Your api token here}"
]
]);
他们想要以“令牌”为前缀的授权标头和令牌......
此外,这个问题会给你更多的想法如何处理你的案件。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句