user1532669
user1532669

Reputation: 2378

why is ohmy-auth twitter request not returning oauth_token?

I'm trying to get the following OAuth Library working:

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

I'm trying to use the Twitter API and so far I'm not getting anywhere. This looks like it should just work out of the box. Looks like the request isn't working properly. Anyone know what the problem with this could be? I also tried the OAuth 2.0 version and that did literally nothing.

If anyone has any suggestions on how to get this working, or can recommend a better library I'd appreciate any tips to help move forward with this.

<?php require_once __DIR__ . '/../vendor/autoload.php';

use ohmy\Auth1;

$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>';
});

This is the URL I get redirected to: https://api.twitter.com/oauth/authorize?oauth_token=

I receive the message:

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.

Upvotes: 0

Views: 290

Answers (1)

user1532669
user1532669

Reputation: 2378

Changing this:

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

to this:

'callback' => 'oob'

Sorted it.

Upvotes: 1

Related Questions