17
17
use LucaDegasperi \OAuth2Server \Filters \CheckAuthCodeRequestFilter ;
18
18
use LucaDegasperi \OAuth2Server \Filters \OAuthFilter ;
19
19
use LucaDegasperi \OAuth2Server \Filters \OAuthOwnerFilter ;
20
+ use Illuminate \Contracts \Exception \Handler ;
20
21
21
22
class OAuth2ServerServiceProvider extends ServiceProvider
22
23
{
@@ -30,10 +31,10 @@ class OAuth2ServerServiceProvider extends ServiceProvider
30
31
* Bootstrap the application events.
31
32
* @return void
32
33
*/
33
- public function boot ()
34
+ public function boot (Handler $ handler )
34
35
{
35
36
$ this ->package ('lucadegasperi/oauth2-server-laravel ' , 'oauth2-server-laravel ' , __DIR__ .'/ ' );
36
-
37
+ $ this -> registerErrorHandlers ( $ handler );
37
38
$ this ->bootFilters ();
38
39
}
39
40
@@ -43,7 +44,6 @@ public function boot()
43
44
*/
44
45
public function register ()
45
46
{
46
- $ this ->registerErrorHandlers ();
47
47
$ this ->registerAuthorizer ();
48
48
$ this ->registerFilterBindings ();
49
49
$ this ->registerCommands ();
@@ -162,9 +162,9 @@ private function bootFilters()
162
162
* Register the OAuth error handlers
163
163
* @return void
164
164
*/
165
- private function registerErrorHandlers ()
165
+ private function registerErrorHandlers (Handler $ handler )
166
166
{
167
- $ this -> app ->error (function (OAuthException $ e ) {
167
+ $ handler ->error (function (OAuthException $ e ) {
168
168
return new JsonResponse ([
169
169
'error ' => $ e ->errorType ,
170
170
'error_description ' => $ e ->getMessage ()
0 commit comments