@andrew_henderson did you ever find out the answer? I'm running into the same issue.
Temporary token issues with Socialite/Twitter
Hello All,
I am having a devil of a time accessing the Twitter API using Socialite. I have several other apps setup using OAuth with no issue, but Twitter dies every time. I have tracked the issue down to a problem with my Temporary Token generation and storage. I can't for the life of me figure out where to go from here to get things working.
My setup is ridiculously simple :
private $socialite;
public function __construct(Socialite $socialite, User $user){
$this->socialite = $socialite;
$this->user = $user;
}
public function execute($hasToken){
if( ! $hasToken ) {
return $this->getAuthorized();
} else {
$user = Socialite::with('twitter')->user();
return $this->interact('statuses/home_timeline.json');
}
}
private function getAuthorized(){
return Socialite::with('twitter')->redirect();
}
Everything works as far as receiving the redirect from Twitter. The response they pass back contains both an oauth_token and an oauth_verifier but the error page I get says either that my Temporary token is missing
Argument 1 passed to League\OAuth1\Client\Server\Server::getTokenCredentials() must be an instance of League\OAuth1\Client\Credentials\TemporaryCredentials, null given, called in /home/vmwmvcom/public_html/aihenderson/vendor/laravel/socialite/src/One/AbstractProvider.php on line 84 and defined
or I get a message warning me that my tokens don't match up (Potential man in the middle).
I've been digging through the Socialite package and have found that the issue is with vendor/laravel/socialite/src/One/AbstractProvider.php:75
protected function getToken()
{
$temp = $this->request->getSession()->get('oauth.temp');
return $this->server->getTokenCredentials(
$temp, $this->request->get('oauth_token'), $this->request->get('oauth_verifier')
);
}
If I dd($temp); here it comes back 'null'
Am I the only one experiencing these issues? Can anyone give me some advice as to how to fix this issue?
I'm at my whits end!
Thanks in advance, Andrew
p.s. The thing that is the most maddening of all is every once in a blue moon the darn thing works. I load up the page, and there are my tweets. I have no idea why it works sometimes. I have no idea why it doesn't work most of the time.
Please or to participate in this conversation.