public function refresh(string $token = null, array $customClaims = [])
    {
        // detect token if none was passed.
        $token = $token ?? $this->detectedToken();

        // if no token was detected.
        if (!$token) {
            return false;
        }

        // if the token cannot be refreshed.
        if (!$this->manager()->canBeRenewed($token)) {
            // abort by returning false.
            return false;
        }

        // try to locate the user which the token belongs to.
        $user = $this->findUserByToken($token);

        // if not user could be found.
        if (!$user) {
            return false;
        }

        // set the user instance.
        $this->user = $user;

        // try to issue a new token and refresh
        try {
            return $this->manager()->issue($user, $customClaims);
        } catch (\Exception $e) {
            return false;
        }
    }