Skip to content

composer require socialiteproviders/twitter SocialiteProviders\Twitter\Provider does not extend Laravel\Socialite\Two\AbstractProvider #1193

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
phpmac opened this issue Apr 15, 2024 · 12 comments

Comments

@phpmac
Copy link

phpmac commented Apr 15, 2024

SocialiteProviders\Twitter\Provider does not extend Laravel\Socialite\Two\AbstractProvider

当我使用twitter提供者会提示出错

SocialiteProviders\Twitter\Provider does not extend Laravel\Socialite\Two\AbstractProvider



@npldevfr
Copy link

npldevfr commented May 13, 2024

same issue here!
Capture d’écran 2024-05-13 à 12 24 47

My AppServiceProvider.php :

public function boot(): void
    {

        Event::listen(function (\SocialiteProviders\Manager\SocialiteWasCalled $event) {
            $event->extendSocialite('discord', \SocialiteProviders\Discord\Provider::class);
            $event->extendSocialite('twitter', \SocialiteProviders\Twitter\Provider::class);
        });
    }

@atymic
Copy link
Member

atymic commented May 21, 2024

Our twitter provider is a oauth v1 provider, which i'm guessing is why it's giving an error.
Can you post the full stacktrace please?

@atymic
Copy link
Member

atymic commented May 21, 2024

Is there a reason why you can't use the offical socialite provider?

@atymic
Copy link
Member

atymic commented Jun 8, 2024

@phpmac

@npldevfr
Copy link

Hi @atymic, sorry for the delay in replying, I hadn't seen your answer !

Here is my stacktrace https://flareapp.io/share/dPbD43A5

@boradatti
Copy link

@atymic I might have figured out a solution. Can you please look at a closely related discussion I created?

@bhagat-abhishek
Copy link

I am facing the same https://prnt.sc/7BCKbYMgx7PC
SocialiteProviders\Twitter\Provider does not extend Laravel\Socialite\Two\AbstractProvider

Can anyone guide me

@andreas-bylund
Copy link

I had the same issue, but with Discogs OAuth. Apparently, Discogs uses OAuth 1, and as @boradatti mentioned in the linked discussion thread, extendSocialite() has a third parameter. I added the third parameter that was missing and and it worked after that.

AppServiceProvider.php

public function boot(): void
{
    Event::listen(function (\SocialiteProviders\Manager\SocialiteWasCalled $event) {
        $event->extendSocialite('discogs', \SocialiteProviders\Discogs\Provider::class, \SocialiteProviders\Discogs\Server::class);
    });
}

@muhghazaliakbar
Copy link

Any news about this issue? 🙄

@paulocastellano
Copy link

+1

Copy link

stale bot commented Apr 26, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Apr 26, 2025
@grinkevich
Copy link

grinkevich commented Jun 11, 2025

Well, same issue hre now in June 2025 :)

P.S. @atymic

Is there a reason why you can't use the offical socialite provider?

I assumed https://github.com/SocialiteProviders/Twitter is an official provider? 🤔


For whoever looks for a clue to fix that, the topic from @boradatti here and the comment from @andreas-bylund were very helpful to get the direction. Much appreciated for the only useful answers in the thread 😸

A quick summary:

  1. Add line "oauth" => 1 to the services.php (this step may be skipped)
'twitter' => [
    'client_id' => env('TWITTER_CLIENT_ID'),
    'client_secret' => env('TWITTER_CLIENT_SECRET'),
    'redirect' => env('TWITTER_REDIRECT_URI'),
    'oauth' => 1,
],
  1. Amend your Listener (for Laravel 11+) by adding SocialiteProviders\Twitter\Server as a third parameter to the extendSocialite call:
use SocialiteProviders\Twitter\Server as TwitterServer;
use SocialiteProviders\Twitter\Provider as TwitterProvider;

Event::listen(function (SocialiteWasCalled $event) {
    $event->extendSocialite('twitter', TwitterProvider::class, TwitterServer::class);
});

This will at least make requests through with OAuth1-compatible communication. I am now struggling to get local domain (just "localhost" or local domains .local, .test, etc) - getting 401 Unauthorised from Twitter, guess I will try later on a real domain. But hey, that's the progress :)

@stale stale bot removed the stale label Jun 11, 2025
grinkevich added a commit to grinkevich/Providers that referenced this issue Jun 12, 2025
Fix for compatibility issues with the latest socialite plugin and eliminating error "SocialiteProviders\Twitter\Provider does not extend Laravel\Socialite\Two\AbstractProvider"

Related topic for this issue and main discussion thread:
SocialiteProviders#1193
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants