.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Net::OAuth::Client 3pm" .TH Net::OAuth::Client 3pm 2023-07-26 "perl v5.38.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Net::OAuth::Client \- OAuth 1.0A Client .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& # Web Server Example (Dancer) \& \& # This example is simplified for illustrative purposes, see the complete code in /demo \& \& # Note that client_id is the Consumer Key and client_secret is the Consumer Secret \& \& use Dancer; \& use Net::OAuth::Client; \& \& sub client { \& Net::OAuth::Client\->new( \& config\->{client_id}, \& config\->{client_secret}, \& site => \*(Aqhttps://www.google.com/\*(Aq, \& request_token_path => \*(Aq/accounts/OAuthGetRequestToken?scope=https%3A%2F%2Fwww.google.com%2Fm8%2Ffeeds%2F\*(Aq, \& authorize_path => \*(Aq/accounts/OAuthAuthorizeToken\*(Aq, \& access_token_path => \*(Aq/accounts/OAuthGetAccessToken\*(Aq, \& callback => uri_for("/auth/google/callback"), \& session => \e&session, \& ); \& } \& \& # Send user to authorize with service provider \& get \*(Aq/auth/google\*(Aq => sub { \& redirect client\->authorize_url; \& }; \& \& # User has returned with token and verifier appended to the URL. \& get \*(Aq/auth/google/callback\*(Aq => sub { \& \& # Use the auth code to fetch the access token \& my $access_token = client\->get_access_token(params\->{oauth_token}, params\->{oauth_verifier}); \& \& # Use the access token to fetch a protected resource \& my $response = $access_token\->get(\*(Aq/m8/feeds/contacts/default/full\*(Aq); \& \& # Do something with said resource... \& \& if ($response\->is_success) { \& return "Yay, it worked: " . $response\->decoded_content; \& } \& else { \& return "Error: " . $response\->status_line; \& } \& }; \& \& dance; .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Net::OAuth::Client represents an OAuth client or consumer. .PP WARNING: Net::OAuth::Client is alpha code. The rest of Net::OAuth is quite stable but this particular module is new, and is under-documented and under-tested. .SH METHODS .IX Header "METHODS" .ie n .IP "new($client_id, $client_secret, %params)" 4 .el .IP "new($client_id, \f(CW$client_secret\fR, \f(CW%params\fR)" 4 .IX Item "new($client_id, $client_secret, %params)" Create a new Client .RS 4 .IP \(bu 4 \&\f(CW$client_id\fR .Sp AKA Consumer Key \- you get this from the service provider when you register your application. .IP \(bu 4 \&\f(CW$client_secret\fR .Sp AKA Consumer Secret \- you get this from the service provider when you register your application. .IP \(bu 4 \&\f(CW$params\fR{site} .IP \(bu 4 \&\f(CW$params\fR{request_token_path} .IP \(bu 4 \&\f(CW$params\fR{authorize_path} .IP \(bu 4 \&\f(CW$params\fR{access_token_path} .IP \(bu 4 \&\f(CW$params\fR{callback} .IP \(bu 4 \&\f(CW$params\fR{session} .RE .RS 4 .RE .SH "LICENSE AND COPYRIGHT" .IX Header "LICENSE AND COPYRIGHT" Copyright 2011 Keith Grennan. .PP This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. .PP See http://dev.perl.org/licenses/ for more information.