Closed vlourme closed 1 year ago
Hey. I had an binding error regarding the CustomUserRepository. A simple 'composer update' did the trick, It seems there was a bug related that was fixed yesterday https://github.com/auth0/laravel-auth0/commits/main. Ensure you have at least the version 7.5.1 I lost few hours myself because of this bug.
also, double check the return User::firstOrCreate( line. You have an extra pair of []. https://laravel-news.com/firstornew-firstorcreate-firstor-updateorcreate
Good luck!
Well, I finally found out. Laravel consider a primary key as an integer
by default, so I had to add this to the Model:
protected $keyType = 'string';
also, double check the return User::firstOrCreate( line. You have an extra pair of []. https://laravel-news.com/firstornew-firstorcreate-firstor-updateorcreate
Just for the information, this is not mandatory because Laravel merges the attributes and values here: https://github.com/laravel/framework/blob/9.x/src/Illuminate/Database/Eloquent/Builder.php#L559. But thank you for trying to help me, I appreciate 😃
Before closing this issue, I would still be interested in two things:
Hi @vlourme 👋
Thanks for creating this!
Hope that helps!
SDK Version
7.5
PHP Version
PHP 8.2
Composer Version
2.x
What happened?
I'm trying to setup a backend CRUD in stateless but the CustomUserRepository does not work correctly.
I have this:
Then, I want to have a UserController that will allow the user to see and manage its profile, like this:
When I make a call to my API (e.g.:
/api/v1/users/
), I get this:But in the database, the ID is correctly saved. This also happen if I use
Auth::id()
.Here is my User model:
How can we reproduce this issue?
I can't tell if this is a real issue, I'm quite a beginner with Auth0. Unfortunately, I think this repository (and the official website) lacks of stateless examples.
Thanks for helping :)
Additional context
App context: Stateless application using Laravel 10.x and frontend is VueJS 3.x (using
auth0/auth0-vue
). The authentication is done via universal login and anaccess_token
is sent in the header for each API request.