NAME

VPNDetection::OauthError - an OAuth request the authorization server refused

SYNOPSIS

my $token = eval { $client->oauth->poll_device_token('your-client-id', $device) };
if (my $error = $@) {
    die 'the sign-in was refused' if ref $error && $error->isa('VPNDetection::OauthAccessDeniedError');
    die 'the code ran out' if ref $error && $error->isa('VPNDetection::OauthExpiredTokenError');
    die $error;
}

DESCRIPTION

A VPNDetection::Error, so code catching every failure the client reports still catches this one. kind follows the status, and a 401 here means the client ID is not registered, never the API key, which these requests do not carry. retryable is always 0.

Two subclasses name the refusals that end a sign-in: VPNDetection::OauthAccessDeniedError, when the person refused it, and VPNDetection::OauthExpiredTokenError, when the device code expired or was already used. A poll that outlives the code raises the second itself, with no status.

METHODS

error_code

The OAuth error code, such as slow_down or invalid_grant.

error_description

The server's error_description, or undef when it sent none.

status

The HTTP status, or undef for a refusal made locally.