Authentication 拉威尔+;tappleby auth令牌包-独立控制器?
我正在构建一个Laravel应用程序,它还包括一个API。我想扩展默认的Laravel身份验证方案,以允许通过令牌访问api。相同的身份验证结构,但有两种工具:通过令牌验证的api用户,通过Laravel的默认身份验证方案验证的web应用程序用户。 我有一个SessionController,用于为web应用程序用户登录和注销:Authentication 拉威尔+;tappleby auth令牌包-独立控制器?,authentication,laravel,token,Authentication,Laravel,Token,我正在构建一个Laravel应用程序,它还包括一个API。我想扩展默认的Laravel身份验证方案,以允许通过令牌访问api。相同的身份验证结构,但有两种工具:通过令牌验证的api用户,通过Laravel的默认身份验证方案验证的web应用程序用户。 我有一个SessionController,用于为web应用程序用户登录和注销: <?php class SessionController extends \BaseController { public function create(
<?php
class SessionController extends \BaseController {
public function create() {
if (Auth::check()) {
return Redirect::to('/post/dashboard');
}
return View::make('sessions.create');
}
public function store() {
if ( Auth::attempt(Input::only('username', 'password')) ) {
return Redirect::to('/post/dashboard');
} else {
return Redirect::to('/login')->with('error', 'Failed Auth.');
}
}
public function destroy() {
Auth::logout();
return Redirect::route('login');
}
}