Issue compatibility with Auth0 #2343
-
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”: On “Spatie\Activitylog”: As you see above in each instance Spatie expects an Authorizable 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? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 9 replies
-
Difficult to answer without a minimal demo app on a fresh laravel installation |
Beta Was this translation helpful? Give feedback.
-
Basically, go to the Spatie PermissionRegistrar.php function, at line 86 you have registerPermission() function, the $user model passed has to be of the type "Authorizable", but the one passed when Auth0 is installed is "Auth0\Laravel\Model\Stateful\User" causing the issue. Basically Auth0 changes the model user type, from Authorizable to Auth0 one, your code does not recognize it and trigger the error. Is this more clear? |
Beta Was this translation helpful? Give feedback.
-
Examples?? |
Beta Was this translation helpful? Give feedback.
-
Already answered here: auth0/laravel-auth0#350 (comment) |
Beta Was this translation helpful? Give feedback.
Already answered here: auth0/laravel-auth0#350 (comment)