Net::OAuth2::Profile - OAuth2 access profiles
Net::OAuth2::Profile is extended by Net::OAuth2::Profile::Password Net::OAuth2::Profile::WebServer
See Net::OAuth2::Profile::WebServer and Net::OAuth2::Profile::Password
Base class for OAuth `profiles'. Currently implemented:
Net::OAuth2::Profile::WebServer
Net::OAuth2::Profile::Password
Next to the OPTIONS listed below, it is possible to provide settings for each of the <${commands}> access_token, protected_resource, authorize, and refresh_token. For each command, you can set
access_token
protected_resource
authorize
refresh_token
${command}_url => URI|STRING
The absolute uri which needs to be used to be addressed to execute the $command. May be specified as URI object or STRING.
$command
${command}_path => PATH
As previous, but relative to the site option value.
site
${command}_method => 'GET'|'POST'
Which method to use for the call (by default POST).
${command}_param => []
Additional parameters for the command.
-Option --Default client_id <required> client_secret <required> grant_type <required> scope undef site undef token_scheme 'auth-header:OAuth' user_agent <created internally>
See add_token() for the supported SCHEMEs. Scheme auth-header is probably the only sane default, because that works with any kind of http requests, where the other options have limited or possible disturbing application.
auth-header
Send the REQUEST (a HTTP::Request object) to the server, calling LWP::UserAgent method request(). This method will NOT add security token information to the message.
request()
Send an authorized request: the TOKEN information gets included in the request object. Returns the answer (HTTP::Response).
example:
my $auth = Net::OAuth2::Profile::WebServer->new(...); my $token = $auth->get_access_token($code, ...); # possible... my $resp = $auth->request_auth($token, GET => $uri, $header, $content); my $resp = $auth->request_auth($token, $request); # nicer (?) my $resp = $token->get($uri, $header, $content); my $resp = $token->request($request);
Merge information from the TOKEN into the REQUEST following the the bearer token SCHEME. Supported schemes:
auth-header or auth-header:REALM
Adds an Authorization header to requests. The default REALM is OAuth, but Bearer and OAuth2 may work as well.
Authorization
OAuth
Bearer
OAuth2
uri-query or uri-query:FIELD
Adds the token to the query parameter list. The default FIELD name used is oauth_token.
oauth_token
form-body or form-body:FIELD
Adds the token to the www-form-urlencoded body of the request. The default FIELD name used is oauth_token.
Returns a HTTP::Request object. PARAMS is an HASH or an ARRAY-of-PAIRS of query parameters.
Decode information from the RESPONSE by the server (an HTTP::Response object). The REASON for this answer is used in error messages.
Construct a URL to address the site. When a full URI is passed, it appends the PARAMS as query parameters. When a PATH is provided, it is relative to new(site).
This module is part of Net-OAuth2 distribution version 0.51, built on January 08, 2013. Website: http://perl.overmeer.net.
Copyrights 2013 on the perl code and the related documentation by [Mark Overmeer] for SURFnet bv, The Netherlands. For other contributors see Changes.
Copyrights 2011-12 by Keith Grennan.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html
To install Net::OAuth2, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::OAuth2
CPAN shell
perl -MCPAN -e shell install Net::OAuth2
For more information on module installation, please visit the detailed CPAN module installation guide.