Hello,
I am working on a sign in for Twitter and am using the OAuth Application. I got it set up and it seemed to work. However, after multiple tests, I unfortunately figured out, that it only works about 20% of the time. The problem has to be the OAuth requestToken procedure
public function getAuthUrl()
{
$this->requestTokens();
$this->verifyTokens();
return $this->client->oauth_authenticate();
}
RequestTokens:
protected function requestTokens()
{
$reply = $this->client->oauth_requestToken(array('oauth_callback' => $this->clientCallback));
$this->storeTokens($reply->oauth_token, $reply->oauth_token_secret);
}
This here is the call to this function in my index.php, however, I think that is all correctly coded:
<?php $auth = new TwitterAuth($db, $client);
?>
<?php if($row_Recordset1['twitter_id'] != "0"): ?>
<p id="SignedInTwitter">Hello, @<?php echo $row_Recordset1['twitter_username']; ?> </p>
<?php else: ?>
<a href="<?php echo $auth->getAuthUrl();?>">Sign in with Twitter</a>
<?php endif; ?>
I really need this to work 100% at the time and not only 10% of the time.
If anybody has any ideas, please let me know… I have been trying to fix this for two days now without any success.
Sincerely, Jan Breuer