This is quick and dirty and assumes that oauth_token and oauth_token_secret
are set in a session before you are redirected to twitter.com to authorize
the application.

$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
$_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);
$access_token = $connection->getAccessToken($_REQUEST['oauth_verifier']);
var_dump($access_token);

Abraham
-------------
Abraham Williams | Hacker Advocate | http://abrah.am
@abraham | http://projects.abrah.am | http://blog.abrah.am
This email is: [ ] shareable [x] ask first [ ] private.


On Fri, Jul 23, 2010 at 09:49, Paul S Gutches <p...@taosinteractive.com>wrote:

>
>
> Ok...
>
> looks like there are others who received the same exception error when
> trying to generate an auth url.
>
> So, I switched over to Abraham's routine, which worked, and the oauth_token
> and verifier came back, but sadly, a new exception was thrown in the
> twitter-async code I was still using to retrieve the key/secret.
>
> Right now I'm trying to use Abraham's twitteroauth to output the same info.
>  Is that possible?
>
> I looked at the class source but they are different enough to make it
> opaque to me.   There is no equivalent setToken in twitteroauth.
>
> Does anyone know how to get twitteroauth to spill the same beans?    I'm so
> close, and yet so far!
>
> for the intrepid, here are the async calls I'm trying to find equivalents
> for in twitteroauth
>
>
> $twitter->setToken( $_GET["oauth_token"] );
> $token = $twitter->getAccessToken( array( "oauth_verifier" =>
> $_GET["oauth_verifier"] ) );
> var_dump( $token->oauth_token, $token->oauth_token_secret );
>
>
> thank you
>
> Paul G
>
>
>
> On Jul 22, 2010, at 5:53 PM, Paul wrote:
>
>  Hi Paul,
>>
>>  Is there a way to retrieve the consumer keys for the other Twitter
>>> account I own without registering an app?
>>>
>>
>> Yep, if you use that script given previously, just login to the other
>> Twitter account instead (with the same consumer key/secret.  This will
>> give you a different pair of tokens for the second account.
>>
>> Initialise as in tweeting example with the new token.  Basically what
>> you're doing is authorising the same app for both accounts.
>>
>> - Paul
>>
>>
>

Reply via email to