Auth0登录ServiceProvider

时间:2017-06-09 03:18:48

标签: laravel laravel-5.4 auth0

我使用Laravel 5.4 Creating your first Laravel app and adding authentication

跟进本教程

但我无法检索Auth0用户,我的仪表板中的注册工作正常新用户是在Auth0服务器中创建的,但不是在我的本地数据库中,我也不能dd(Auth0::getUser());

我收到此错误:

  

找不到类'Auth0 \ Login \ LoginServiceProvider'

我添加了这个

Auth0\Login\LoginServiceProvider::class

在我的提供者数组中

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

在我的别名中。

This is my controller 我从Auth0文档中完成了所有配置步骤:Auth0 PHP (Laravel) SDK

我现在不在选择!

1 个答案:

答案 0 :(得分:1)

好的,现在搞清楚。

错误来自AppServiceProvider.php'

只需将AppServiceProvider.php中的这两个类导入为:

val testList = mutableListOf(1, 2, 3)
testList.swap(0, 2)

然后你的Register方法应如下所示:

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

如果要在数据库中保留数据,则创建自己的存储库并更新绑定方法public function register() { $this->app->bind( Auth0UserRepositoryContract::class, Auth0UserRepository::class ); $this->app->bind( Auth0UserRepositoryContract::class, Auth0UserRepository::class ); } 就像那样。

有关创建自己的存储库的更多信息 here

相关问题