【发布时间】:2015-10-04 05:08:40
【问题描述】:
我想获得有效链接https://bitbucket.org/{username}/rss/feed?token={token}(这是主要问题),然后在 CLI 中从该链接获得有效响应。
我知道我需要的参数,例如consumer_key, consumer_secret, request_token_url, authenticate_url, access_token_url.
我尝试使用StudioIbizz\OAuth\OAuth1,但似乎是为浏览器设计的,而不是为 CLI 设计的。
我试着跑了:
$this->OAuth = new \StudioIbizz\OAuth\OAuth1($this->consumer_key,$this->consumer_secret);
$requestToken = $this->OAuth->getRequestToken($this->request_token_url,$this->authenticate_url);
$token = $requestToken['oauth_token_secret'];
并将此 $token 粘贴到我的 RSS 链接,但随后我看到来自 Bitbucket 的消息 You must have read access to access the RSS feed.。
我需要针对严重傻瓜的分步说明。
编辑:我试过这个:
$accessToken = $this->OAuth->getAccessToken($this->access_token_url,$requestToken['oauth_token_secret'],$requestToken['oauth_token']);
但后来我明白了:
Fatal error: Uncaught exception 'StudioIbizz\OAuth\OAuthException' with message 'Unexpected HTTP status #400'
【问题讨论】:
-
我在 Bitbucket 文档中找不到任何关于您应该通过提要 URL 传递的令牌的信息,但我确信 OAuth 提供的令牌对您没有帮助。我在这里做了一些尝试,即使提供有效的 OAuth 令牌,您也需要登录。您想从提要中获得什么样的信息?也许您可以使用特定的 API 方法来获得它。