NAME
OAuth::Lite2::Server::Error - OAuth 2.0 server errors
SYNOPSIS
# At End-User Endpoint
try {
if ($something_wrong) {
OAuth::Lite2::Server::Error::InvalidRequest->throw(
description => q{Something wrong},
# state => q{foo},
);
}
} catch {
if ($_->isa("OAuth::Lite2::Server::Error")) {
my $uri = URI->new( $client_callback_uri );
my %error_params = ( error => $_->type );
$error_params{error_description} = $_->description if $_->description;
$error_params{state} = $_->state if $_->state;
$uri->query_form(%error_params);
$your_app->redirect( $uri->as_string );
} else {
# Internal Server Error
}
};
# At token-endpoint
try {
} catch {
if ($_->isa("OAuth::Lite2::Server::Error")) {
my %error_params = ( error => $_->type );
$error_params{error_description} = $_->description if $_->description;
$error_params{scope} = $_->scope if $_->scope;
$req->new_response($_->code,
[ "Content-Type" => $formatter->type, "Cache-Control" => "no-store" ],
[ $formatter->format(\%error_params) ],
);
} else {
# rethrow
die $_;
}
};
DESCRIPTION
OAuth 2.0 error classes.
See http://tools.ietf.org/html/draft-ietf-oauth-v2-09#section-3.2, http://tools.ietf.org/html/draft-ietf-oauth-v2-09#section-4.3, http://tools.ietf.org/html/draft-ietf-oauth-v2-09#section-5.2
METHODS
There are following errors
ERRORS
- OAuth::Lite2::Server::Error::AccessDenied
- OAuth::Lite2::Server::Error::ExpiredToken
- OAuth::Lite2::Server::Error::ExpiredTokenLegacy
- OAuth::Lite2::Server::Error::InvalidRequest
- OAuth::Lite2::Server::Error::InvalidToken
- OAuth::Lite2::Server::Error::InvalidClient
- OAuth::Lite2::Server::Error::InvalidGrant
- OAuth::Lite2::Server::Error::InvalidScope
- OAuth::Lite2::Server::Error::RedirectURIMismatch
- OAuth::Lite2::Server::Error::UnsupportedGrantType
- OAuth::Lite2::Server::Error::UnsupportedResourceType
AUTHOR
Lyo Kato, <lyo.kato@gmail.com>
COPYRIGHT AND LICENSE
Copyright (C) 2010 by Lyo Kato
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.