【发布时间】:2018-02-25 19:11:29
【问题描述】:
我正在使用 5.5 larevel 的版本和 postman 来测试 API。
我运行了命令
php 工匠护照:client --password
生成 id 和 secret。当我发布localhost:8000/oauth/token
发帖:
它返回给我一个令牌,但是当我想获得一个 enpoints 值时,它返回给我未经身份验证
这里是路由 api.php
<?php
use Illuminate\Http\Request;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
Route::middleware('auth:api')->get('/users', function (Request $request) {
return $request->user();
});
Route::middleware('auth:api')->get('/subjects','SubjectController@index');
【问题讨论】:
标签: laravel-5