Hi,
I have been trying to integrate the latest version of Auth0 with spatie/laravel-permission
‘and Spatie\Activitylog’ in my Laravel 9 application; it was working fine with Laravel 8, but the latest Auth0 version changes drastically auth.php file, changing the guards used by Spatie plugins. I believe this is causing quite a few conflicts. I might be wrong with my diagnoses, probably the reasons could be different, but the following is the error which appears when trying to login into my application:
On “Spatie/permissions”:
Spatie\Permission\PermissionRegistrar::Spatie\Permission{closure}(): Argument #1 ($user) must be of type Illuminate\Contracts\Auth\Access\Authorizable, Auth0\Laravel\Model\Stateful\User given, called in /var/www/html/vendor/laravel/framework/src/Illuminate/Auth/Access/Gate.php on line 553
On “Spatie\Activitylog”:
Spatie\Activitylog\CauserResolver::getDefaultCauser(): Return value must be of type ?Illuminate\Database\Eloquent\Model, Auth0\Laravel\Model\Stateful\User returned
As you see above in each instance Spatie expects a type of Model or Function instead an Model\Stateful\User is returned by Auth0, so, triggering the error.
Could you please help me to understand how to solve the issue?
Thanks,
William