teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

3

ルート定義の参考例を追記

2017/08/05 05:24

投稿

aro10
aro10

スコア4106

answer CHANGED
@@ -37,4 +37,33 @@
37
37
  </div>
38
38
  </body>
39
39
  </html>
40
- ```
40
+ ```
41
+
42
+ authのミドルウェアを外したclient登録のルート定義の参考例
43
+ RouteServiceProvider.php
44
+ ```
45
+ public function map()
46
+ {
47
+ $this->mapApiRoutes();
48
+
49
+ $this->mapWebRoutes();
50
+ #Laravel\Passport\RouteRegistrarより prefixをoauth_no_loginに変更
51
+ Route::group(['prefix' => 'oauth_no_login', 'namespace' => 'Laravel\Passport\Http\Controllers','middleware' => ['web']], function ($router) {
52
+ $router->get('/clients', [
53
+ 'uses' => 'ClientController@forUser',
54
+ ]);
55
+
56
+ $router->post('/clients', [
57
+ 'uses' => 'ClientController@store',
58
+ ]);
59
+
60
+ $router->put('/clients/{client_id}', [
61
+ 'uses' => 'ClientController@update',
62
+ ]);
63
+
64
+ $router->delete('/clients/{client_id}', [
65
+ 'uses' => 'ClientController@destroy',
66
+ ]);
67
+ });
68
+ }
69
+ ```

2

追記

2017/08/05 05:24

投稿

aro10
aro10

スコア4106

answer CHANGED
@@ -10,4 +10,31 @@
10
10
 
11
11
  以下の記事なども参考にしてください
12
12
  [LARAVEL 5.3 で PASSPORTを試す](https://blog.hinaloe.net/2016/09/15/try-passport-laravel-5-3/)
13
- [API認証(Passport)機能の動作確認](http://www.dn-web64.com/archives/web/laravel_passport/)
13
+ [API認証(Passport)機能の動作確認](http://www.dn-web64.com/archives/web/laravel_passport/)
14
+
15
+ ## 検証に利用したPassportのvueコンポーネントを使うbladeテンプレート
16
+ ※ app.jsとapp.cssはLaravel mixにて作成されるので、ドキュメントのフロントエンド・クイックスタートの導入後npm run devで事前にビルドしておいてください
17
+
18
+ ```
19
+ <!doctype html>
20
+ <html lang="en">
21
+ <head>
22
+ <meta charset="UTF-8">
23
+ <meta name="viewport"
24
+ content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
25
+ <meta http-equiv="X-UA-Compatible" content="ie=edge">
26
+ <meta name="csrf-token" content="{{ csrf_token() }}">
27
+ <title>Document</title>
28
+ <link rel="stylesheet" href="{{ mix('css/app.css') }}">
29
+ <script src="{{ mix('js/app.js') }}" defer></script>
30
+ </head>
31
+ <body>
32
+
33
+ <div id="app">
34
+ <passport-clients></passport-clients>
35
+ <passport-authorized-clients></passport-authorized-clients>
36
+ <passport-personal-access-tokens></passport-personal-access-tokens>
37
+ </div>
38
+ </body>
39
+ </html>
40
+ ```

1

誤字修正

2017/07/29 23:44

投稿

aro10
aro10

スコア4106

answer CHANGED
@@ -4,7 +4,7 @@
4
4
  開発検証を行う手順としては、
5
5
  1. Laravel Passportを導入
6
6
  2. php artisan make:auth でログイン画面のスキャフォールドを作成し、ユーザー登録とユーザーログインを行う
7
- 3. その後に/oauth/clientsの (vendor:publishで作成されるVueの管理画面で検証)
7
+ 3. その後に/oauth/clientsvendor:publishで作成されるVueの管理画面で検証
8
8
 
9
9
  動作が確認できて出来ていない状態でjQueryで頑張るよりも、用意されたVueコンポーネントから理解するほうが早いと思います。
10
10