【问题标题】:HTTP/1.1 401 Authorization Required Error - Twitter APIHTTP/1.1 401 需要授权错误 - Twitter API
【发布时间】:2019-02-19 11:43:41
【问题描述】:

发送以下流 api 请求时出现错误 401。 但是,当我尝试将 curl 与授权标头一起使用时,它可以正常工作。 请指教我做错了什么。

REQUEST
GET /1.1/statuses/filter.json HTTP/1.1
Accept: /
User-Agent: Qapla
Content-Type: application/x-www-form-urlencoded
Authorization: https://stream.twitter.com/1.1/statuses/sample.json?language=en&oauth_consumer_key=GuYuxjwY&oauth_nonce=u4a3R_n&oauth_signature_method=HMAC-SHA1&oauth_timestamp=153693&oauth_token=103405936-vfmrGkclVE8siUIF&oauth_version=1.0&oauth_signature=R2qVlT2aLVgi8SMA%3D
Host: stream.twitter.com

ERROR RESPONSE
HTTP/1.1
401
Authorization
Required
cache-control:
must-revalidate,no-cache,no-store
connection:
close
content-length:
266
content-type:
text/html
date:
Fri,
14
Sep
2018
15:19:31
GMT
server:
tsa
www-authenticate:
Basic
realm=“Firehose”
x-connection-hash:
cd3e38a2d55e0a8831776b96d862d3a2

【问题讨论】:

    标签: http oauth-2.0 twitter-streaming-api


    【解决方案1】:

    授权标头无效,它不应该是一个url,而应该是某种具有某种价值的东西,如果你可以访问API,你会在API控制台中找到它

    【讨论】:

    • 谢谢桑杰。你的意思是这样的授权:OAuth的oauth_consumer_key = “xvz1evFS4wEEPTGEFPHBog”,oauth_nonce = “kYjzVBB8Y0ZFabxSWbWovY3uYSQ2pTgmZeNu2VS4cg”,oauth_signature = “tnnArxj06cWHq44gCs1OSKk%2FjLY%3D”,oauth_signature_method = “HMAC-SHA1”,oauth_timestamp = “1318622958”,组oauth_token =“370773112- GmHxMAGYyLbNETIKZeRNFsMKPR9EyMZeS9we​​JAEb",
    • 谢谢桑杰。我修改了请求消息。它奏效了。
    猜你喜欢
    • 2011-09-26
    • 2023-03-11
    • 2019-12-05
    • 1970-01-01
    • 2023-02-23
    • 2014-08-04
    • 2015-04-28
    • 2014-11-21
    • 2021-05-04
    相关资源
    最近更新 更多