Thanks Abraham.

I'm still a bit baffled, but I'm sure the origin is local, haha.

I used your testing routine with the "Sign in to Twitter" dialog to try to access the account token and secret for storage. In your redirect.php file, it does look like you are setting session vars in there for the token and secret before the redirect to Twitter.

But it also says in your comments that those are temporary credentials. I was confused by that, because it's my understanding they're not supposed to expire, which is how they can be used again for future access. Do I have that wrong? I'm looking for the credentials that developers are storing for re-use of their user's Twitter accounts.

Even though your redirect.php file is creating a session for the variables, when the callback to the quick and dirty code occurs, the variables are not accessible. I get the below notices.

<br />
<b>Notice</b>: Undefined variable: _SESSION in <b>/path/twittertest- oauth2.php</b> on line <b>21</b><br />
<br />
<b>Notice</b>: Undefined variable: _SESSION in <b>/path/twittertest- oauth2.php</b> on line <b>21</b><br />
<br />
<b>Notice</b>: Undefined index: oauth_token in <b>/path/twitteroauth/ twitteroauth.php</b> on line <b>118</b><br />
<br />
<b>Notice</b>: Undefined index: oauth_token_secret in <b>/path/ twitteroauth/twitteroauth.php</b> on line <b>118</b><br />
array(1) {
  [" "]=>
  string(0) ""
}

Any advice for keeping hope alive?  :)

Thanks again

Paul G


On Jul 23, 2010, at 1:13 PM, Abraham Williams wrote:

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.

Reply via email to