-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathroutes.php
47 lines (39 loc) · 1.22 KB
/
routes.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php //namespace mikp\sanctum\Routes;
$version = 'v1';
$api_name = '/sanctum';
$base_uri = '/api/' . $version . $api_name;
// api doc json file
Route::get($base_uri . '/sanctum/api-docs.json', 'mikp\sanctum\Http\Controllers\API@docs');
// token API
Route::group([
'prefix' => $base_uri . '/token',
'middleware' => [
'api',
'web',
'Winter\User\Classes\AuthMiddleware',
]
], function () {
// index
Route::get('/', 'mikp\sanctum\Http\Controllers\API@index');
// create a token
Route::post('/create', 'mikp\sanctum\Http\Controllers\API@create');
// Route::get('/create', 'mikp\sanctum\Http\Controllers\API@create');
});
Route::group([
'prefix' => $base_uri . '/token',
'middleware' => [
'api',
'web',
// 'mikp\sanctum\Http\Middleware\UserFromBearerToken',
'mikp\sanctum\Http\Middleware\SoftUserFromBearerToken',
'Winter\User\Classes\AuthMiddleware',
// 'auth',
// 'auth:api',
// 'auth:sanctum',
]
], function () {
// refresh token
Route::post('/refresh', 'mikp\sanctum\Http\Controllers\API@refresh');
// revoke token
Route::post('/revoke/{tokenId}', 'mikp\sanctum\Http\Controllers\API@revoke');
});