+ $this->validateTokenHeaderValue($authToken);
+
+ [$id, $secret] = explode(':', str_replace('Token ', '', $authToken));
+ $token = ApiToken::query()
+ ->where('token_id', '=', $id)
+ ->with(['user'])->first();
+
+ $this->validateToken($token, $secret);
+
+ if ($this->loginService->awaitingEmailConfirmation($token->user)) {
+ throw new ApiAuthException(trans('errors.email_confirmation_awaiting'));
+ }
+
+ return $token->user;
+ }
+
+ /**
+ * Validate the format of the token header value string.
+ *
+ * @throws ApiAuthException
+ */
+ protected function validateTokenHeaderValue(string $authToken): void
+ {