-
Notifications
You must be signed in to change notification settings - Fork 136
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
Laravel Spark multiple errors with User Object #144
Comments
So I've spent sometime trying to get this to work... I'm currently neck deep in spaghetti code trying to modify the Spark code to accept the Auth0 user object... Really not comfortable with basically breaking apart Spark to make this work. I feel like all of this would be completely avoided if Auth0 did not replace the laravel "Auth" middleware... so for example "auth->user()" returns an Auth0User model, instead if this was kept as the original "User" model everything would work completely fine Q.Q Is there a way to keep Auth0 working for the auth->check part, but not everything else? |
So managed to solve this!!! Woop, would have been a pain to rebuild the App from scratch using Laravel and/or not use Auth0 + Spark... So the method I used was to modify the custom auth0 repository you make in the last step of the guide, instead of returning an new Auth0User, I return the standard User model from $user. The code looks as follows...
|
Hi @krthush, how come you were able to return the user object.
|
Can you provide some additional information? Are you using a custom user repo + modified it like I mentioned? |
@krthush @lhuria94 is right. The example wants to be so
and when I change as you say for Laravel Spark
I get Symfony\Component\ErrorHandler\Error\FatalError I wonder how you have setup config/auth.php too |
Description
I'm trying to integrate my Laravel Spark project with Auth0, I followed the guide here https://auth0.com/docs/quickstart/webapp/laravel, including the section on Custom User Handling - i.e. implementing a custom user repository succesfully.
Now I run into the problems because Laravel Spark oftern calls functions on the User object (such as hasTeams, etc.)... Now an earlier solution for this was to replace all function calls on the User object with a middle step and create a App\User::current() instead here: #114. This isn't really feasible for my Spark project as I would have to completely take apart Spark to replace all the function calls...
Is there any way of just extending the user provider or override it using the magic of the service container? Would really like to use both Spark + Auth0 without having to dump one of them...
The text was updated successfully, but these errors were encountered: