Laravel Auth外部数据用于登录和注册 [英] Laravel Auth external data for login and register
问题描述
我正在使用此命令附带的Laravel 5.2 Auth系统:
I am using the Laravel 5.2 Auth system coming up with this command :
php artisan make:auth
尽管这完全可以正常工作,但我的目标是使用外部API进行登录,注册和更改密码,同时仍然能够使用Auth类的核心功能.
Although this works totally fine as is, my goal is to use an external API to perform login, registering and changing password while still being able to use the core function of the Auth class.
以登录为例,我想使用
function login(ApiController $api) {
// This function return data or error code and message in JSON
$login = $api->login([ $credentials['email'], $credentials['password']]);
if($login->success)
// login successfully like normal Auth would do
else
// redirect to main page with $login->message
}
顺便说一句,我想将$ login中出现的字段传递给Auth类,就像我们可以实际执行Auth :: user()-> email给我们发送电子邮件一样,我想将值设置为数据库字段",但后面有我的API JSON字段
By the way, I want to pass fields coming up from $login to the Auth class, like we can actually do Auth::user()->email giving us the email, I'd want to set value like "database field" but with my API JSON fields behind
我在Internet上找到了可以在AuthController中做的事情以及与ServiceProvider有关的事情,但是我不知道如何满足我的确切需求
I looked on the Internet and found something to do inside AuthController and something related to ServiceProvider, but I don't know how to follow my exact needs
推荐答案
我最终编写了自己的Auth系统...
I ended up coding my own Auth system...
使用session()和Input()
Using session() and Input()
这篇关于Laravel Auth外部数据用于登录和注册的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!