1

We are developing an Laravel 8(.83.5) application and are currently doing this locally.

We've successfully (but partially) implemented SSO using Laravel Socialite for Microsoft Azure and Google. Both have worked on both our computers (Mac and Windows).

Suddenly (some days later), but without any code changes, I am getting an InvalidStateException when trying to login (using both Microsoft or Google), on my Mac.

Specifically this error:

SocialiteProviders\Manager\OAuth2\AbstractProvider::user
vendor/socialiteproviders/manager/src/OAuth2/AbstractProvider.php:54

on this line

$user = Socialite::driver($provider)->user();

Troubleshooting we've done so far:

  1. Basic things such as: reboot, different browsers, logging in as different user, webbrowser private mode, deleting cookies, etc.
  2. Removed all sorts of caching from Laravel and composer
php artisan config:clear  
php artisan cache:clear  
php artisan clear-compiled   
php artisan route:clear    
composer dump-autoload 
  1. It does (still) perfectly work on another (Windows) PC.
  2. Cloned code again from Git and reinstalled all Composer packages. (Basically begun all over with the code from the working computer).
  3. Used the exactly same .env-file from the working PC (is not included in Git)
  4. Checked the rights on the storage/framework/sessions folder.
  5. Checked the answers for this question, specifically this one.

The only thing that works

When adding stateless to the callback line. But this is not what we want and should not be necessary (we think) as it works on the other PC. Like so:

$userMicrosoft = Socialite::driver('azure')->stateless()->user();
ebeo
  • 83
  • 6
  • Happening to me as well. Just upgraded from PHP 7.4 to 8.0 on Laravel 6. Socialite was at 5.5.2 and went to 5.5.5, but rolling that back made no difference. Also using the microsoft driver – dsturbid Sep 26 '22 at 15:19

0 Answers0