2 years ago

Lumen 5.5 Socialite Providers doesn't works with setConfig()

Posted 2 years ago by pirmax

I use Laravel Socialite Providers (https://socialiteproviders.github.io/) to login user on Lumen 5.5 API. setConfig() method, to force config, doesn't works for me...

Here below, my error and my code. The problem is that I do not know why I have this error.

Display Error:

Type error: Argument 1 passed to Laravel\Socialite\SocialiteManager::formatConfig() must be of the type array, null given, called in /home/vagrant/www/project1/api.website.app/vendor/laravel/socialite/src/SocialiteManager.php on line 125

PHP code:

$clientId = env('TWITTER_KEY');
$clientSecret = env('TWITTER_SECRET');
$redirectUrl = env('TWITTER_REDIRECT_URI');
$additionalProviderConfig = [];
$config = new SocialiteConfig($clientId, $clientSecret, $redirectUrl, $additionalProviderConfig);

return Socialite::with('twitter')->stateless()->setConfig($config)->redirect();

Please sign in or create an account to participate in this conversation.