Laravel自定义身份验证

时间:2015-03-06 00:30:16

标签: php authentication laravel laravel-5

我开始发现Laravel 5,所以我可能需要你的帮助来理解一些事情。

首先,我想开发一个登录页面。看来Laravel有一个完整的身份验证系统,我想我应该使用它。

尽管如此,我想显示一个登录页面(我知道如何做到这一点!),但在此之后,我想通过API调用将凭据发送到服务器。然后,服务器将告诉我是否允许用户登录。

据我了解Laravel和身份验证,似乎身份验证系统仅适用于本地数据库。

您能否确认我需要使用自定义身份验证驱动程序来执行此操作? 我一直关注this solution 但加载我的页面时出现此错误:

FatalErrorException in CustomUserProvider.php line 6:
Interface 'Illuminate\Auth\UserProviderInterface' not found

如果您需要帮助,请随时向我索取更多信息。

由于

1 个答案:

答案 0 :(得分:1)

这是我的CustomUserProvider文件:

<?php namespace App\Auth;

use Illuminate\Contracts\Auth\UserProvider as UserProviderInterface;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Auth\GenericUser;

class CustomUserProvider implements UserProviderInterface {

现在正在运作: - )