/** * Get the token for the given request cookie. * * @param Request $request * @return Token */ protected function getTokenFromCookie($request) { // If we need to retrieve the token from the cookie, it'll be encrypted so we must // first decrypt the cookie and then attempt to find the token value within the // database. If we can't decrypt the value we'll bail out with a null return. try { $token = JWT::decode($request->cookie('kodicms_token')); } catch (Exception $e) { return; } return $this->tokens->valid($token['token']); }