@@ 7-22 (lines=16) @@ | ||
4 | ||
5 | use Illuminate\Auth\AuthenticationException; |
|
6 | ||
7 | trait AuthenticationHandler |
|
8 | { |
|
9 | public function authenticationException(AuthenticationException $exception) |
|
10 | { |
|
11 | $error = [[ |
|
12 | 'status' => 401, |
|
13 | 'code' => $this->getCode('authentication'), |
|
14 | 'source' => ['pointer' => $exception->getFile().':'.$exception->getLine()], |
|
15 | 'title' => $exception->getMessage(), |
|
16 | 'detail' => __('exception::exceptions.authentication.detail'), |
|
17 | ]]; |
|
18 | ||
19 | $this->jsonApiResponse->setStatus(401); |
|
20 | $this->jsonApiResponse->setErrors($error); |
|
21 | } |
|
22 | } |
|
23 |
@@ 7-22 (lines=16) @@ | ||
4 | ||
5 | use Laravel\Passport\Exceptions\MissingScopeException; |
|
6 | ||
7 | trait MissingScopeHandler |
|
8 | { |
|
9 | public function missingScopeException(MissingScopeException $exception) |
|
10 | { |
|
11 | $error = [[ |
|
12 | 'status' => 403, |
|
13 | 'code' => $this->getCode('missing_scope'), |
|
14 | 'source' => ['pointer' => $exception->getFile().':'.$exception->getLine()], |
|
15 | 'title' => 'missing_scope', |
|
16 | 'detail' => $exception->getMessage(), |
|
17 | ]]; |
|
18 | ||
19 | $this->jsonApiResponse->setStatus(403); |
|
20 | $this->jsonApiResponse->setErrors($error); |
|
21 | } |
|
22 | } |
|
23 |