为什么ohmy-auth twitter请求不返回oauth_token ?



我正在尝试获得以下OAuth库工作:

https://github.com/sudocode/ohmy-auth

我正在尝试使用Twitter API,到目前为止我没有得到任何地方。这看起来应该是开箱即用的。看起来请求不能正常工作。有人知道这有什么问题吗?我还尝试了OAuth 2.0版本,它实际上什么也没做。

如果有人对如何使其工作有任何建议,或者可以推荐一个更好的库,我将非常感谢任何帮助向前推进的提示。

<?php require_once __DIR__ . '/../vendor/autoload.php';
use ohmyAuth1;
$twitter = Auth1::legs(3)
        # configuration
        ->set(array(
            'key'      => 'my-key',
            'secret'   => 'my-secret',
            'callback' => 'my-callback-page'
        ))
        # oauth flow
        ->request('https://api.twitter.com/oauth/request_token')
        ->authorize('https://api.twitter.com/oauth/authorize')
        ->access('https://api.twitter.com/oauth/access_token');
// test GET call
$twitter->GET('https://api.twitter.com/1.1/statuses/home_timeline.json', array('count' => 5))
->then(function($response) {
    echo '<pre>';
    var_dump($response->json());
    echo '</pre>';
});

这是重定向到的URL: https://api.twitter.com/oauth/authorize?oauth_token=

我收到消息:

Whoa there!
There is no request token for this page. That's the special key we need from applications asking to use your Twitter account. Please go back to the site or application that sent you here and try again; it was probably just a mistake.

改变这个:

'callback' => 'my-callback-page'

:

'callback' => 'oob'

排序。

最新更新