1
votes

I follow up this tutorial using Laravel 5.4 Creating your first Laravel app and adding authentication

But I can't retrieve Auth0 users, the registration works fine in my dashboard new users are created in Auth0 server, but not in my local database and also I can't dd(Auth0::getUser());

I get this error:

Class 'Auth0\Login\LoginServiceProvider' not found

I've added this

Auth0\Login\LoginServiceProvider::class

in my provider array and

'Auth0' => Auth0\Login\Facade\Auth0::class

in my aliases.

This is my controller I did all steps on configuration from Auth0 docs: Auth0 PHP (Laravel) SDK

I'm out off option now!

1
did you do composer dump-autoload?Odin Thunder
Yes, did that all time but still same error.madeny

1 Answers

1
votes

Ok, figure it out now.

The error was coming from 'AppServiceProvider.php'

Just import those two classes in AppServiceProvider.php as:

use Auth0\Login\Contract\Auth0UserRepository as Auth0UserRepositoryContract; 
use Auth0\Login\Repository\Auth0UserRepository as Auth0UserRepository;

And then your Register method should look like this:

public function register()
{
   $this->app->bind( Auth0UserRepositoryContract::class, Auth0UserRepository::class ); 
   $this->app->bind( Auth0UserRepositoryContract::class, Auth0UserRepository::class ); 
}

if you want to persist data in your database then Create your own Repository and update the bind method YourCustomerRepositoryContract::class, YourCustomerRepository::class Just like that.

For more info about creating your own Repository Auth0 PHP (Laravel) SDK Quickstarts: Login