2015-07-15 16 views
10

Desidero ottenere il collegamento valido https://bitbucket.org/{username}/rss/feed?token={token} (questo è il problema principale) e quindi ottenere una risposta valida da questo collegamento nella CLI.Come ottenere un token RSS per BitBucket tramite la CLI di PHP?

Conosco i miei parametri richiesti, ad es. consumer_key, consumer_secret, request_token_url, authenticate_url, access_token_url.

Ho provato a utilizzare StudioIbizz\OAuth\OAuth1, ma sembra progettato per il browser, non per la CLI.

ho provato a correre:

$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']; 

e incolla questo $token al mio link RSS, ma poi vedo un messaggio You must have read access to access the RSS feed. da Bitbucket.

Ho bisogno di istruzioni passo-passo per manichini seri.


Edit: Ho provato questo:

$accessToken = $this->OAuth->getAccessToken($this->access_token_url,$requestToken['oauth_token_secret'],$requestToken['oauth_token']); 

Ma allora ottengo questo:

Fatal error: Uncaught exception 'StudioIbizz\OAuth\OAuthException' with message 'Unexpected HTTP status #400' 
+0

non riuscivo a trovare nulla in bitbucket documentazione circa il token si dovrebbe passare lungo l'URL del feed, ma sono sicuro che il token proposta dal OAuth non vi aiuterà. Ho fatto alcuni tentativi qui e devi essere loggato anche quando si fornisce un token OAuth valido. Che tipo di informazioni vorresti ottenere dal feed? Forse puoi usare un metodo API specifico per ottenerlo. –

risposta

0

Si potrebbe utilizzare stevenmaguire di Bitbucket OAuth 2.0 support per il PHP League OAuth 2.0 Client.

$provider = new Stevenmaguire\OAuth2\Client\Provider\Bitbucket([ 
    'clientId'   => '{bitbucket-client-id}', 
    'clientSecret'  => '{bitbucket-client-secret}', 
    'redirectUri'  => 'https://example.com/callback-url' 
]); 

$token = $_GET['code']; 
Problemi correlati