Search code examples
phplaraveltwitterlaravel-socialite

Laravel Socialite Implement stateless for Twitter


I would like to implement stateless method to Twitter but it seems that it is not available for TwitterProvider class as it returns Call to undefined method Laravel\Socialite\One\TwitterProvider::stateless()

Here is my redirectToProvider method currently.

public function redirectToProvider($socialMedia)
{
    $provider = strtolower($socialMedia);

    return Socialite::driver($provider)->stateless()->redirect();

    throw new NotFoundHttpException;        
}

What is the correct implementation or what do I miss?


Solution

  • As mentioned by @driesvints from this question #415 I've opened at the Laravel Socialite repository, stateless is unavailable for Twitter since it uses OAuth 1.0.

    They already pushed a PR #5661 to update also the Laravel Docs mentioning this specification. Click the link to see the update. Staless Authentication

    I would update this answer if whatever my solution would be.