Scroll to navigation

OAuth::Lite2::Server::Error(3pm) User Contributed Perl Documentation OAuth::Lite2::Server::Error(3pm)

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>, <http://tools.ietf.org/html/rfc6749>,

METHODS

There are following errors

ERRORS

AUTHOR

Ryo Ito, <ritou.06@gmail.com>

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.

2023-07-01 perl v5.36.0