- if ($token === null) {
- return $this->unauthorisedResponse(trans('errors.api_user_token_not_found'));
- }
-
- if (!Hash::check($secret, $token->secret)) {
- return $this->unauthorisedResponse(trans('errors.api_incorrect_token_secret'));
- }
-
- if (!$token->user->can('access-api')) {
- return $this->unauthorisedResponse(trans('errors.api_user_no_api_permission'), 403);
- }
-
- auth()->login($token->user);
-
- return $next($request);