{
    "mode": "perldoc",
    "parameter": "Net::OAuth::Client",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Net%3A%3AOAuth%3A%3AClient/json",
    "generated": "2026-06-12T21:12:34Z",
    "synopsis": "# Web Server Example (Dancer)\n# This example is simplified for illustrative purposes, see the complete code in /demo\n# Note that clientid is the Consumer Key and clientsecret is the Consumer Secret\nuse Dancer;\nuse Net::OAuth::Client;\nsub client {\nNet::OAuth::Client->new(\nconfig->{clientid},\nconfig->{clientsecret},\nsite => 'https://www.google.com/',\nrequesttokenpath => '/accounts/OAuthGetRequestToken?scope=https%3A%2F%2Fwww.google.com%2Fm8%2Ffeeds%2F',\nauthorizepath => '/accounts/OAuthAuthorizeToken',\naccesstokenpath => '/accounts/OAuthGetAccessToken',\ncallback => urifor(\"/auth/google/callback\"),\nsession => \\&session,\n);\n}\n# Send user to authorize with service provider\nget '/auth/google' => sub {\nredirect client->authorizeurl;\n};\n# User has returned with token and verifier appended to the URL.\nget '/auth/google/callback' => sub {\n# Use the auth code to fetch the access token\nmy $accesstoken =  client->getaccesstoken(params->{oauthtoken}, params->{oauthverifier});\n# Use the access token to fetch a protected resource\nmy $response = $accesstoken->get('/m8/feeds/contacts/default/full');\n# Do something with said resource...\nif ($response->issuccess) {\nreturn \"Yay, it worked: \" . $response->decodedcontent;\n}\nelse {\nreturn \"Error: \" . $response->statusline;\n}\n};\ndance;",
    "sections": {
        "NAME": {
            "content": "Net::OAuth::Client - OAuth 1.0A Client\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "# Web Server Example (Dancer)\n\n# This example is simplified for illustrative purposes, see the complete code in /demo\n\n# Note that clientid is the Consumer Key and clientsecret is the Consumer Secret\n\nuse Dancer;\nuse Net::OAuth::Client;\n\nsub client {\nNet::OAuth::Client->new(\nconfig->{clientid},\nconfig->{clientsecret},\nsite => 'https://www.google.com/',\nrequesttokenpath => '/accounts/OAuthGetRequestToken?scope=https%3A%2F%2Fwww.google.com%2Fm8%2Ffeeds%2F',\nauthorizepath => '/accounts/OAuthAuthorizeToken',\naccesstokenpath => '/accounts/OAuthGetAccessToken',\ncallback => urifor(\"/auth/google/callback\"),\nsession => \\&session,\n);\n}\n\n# Send user to authorize with service provider\nget '/auth/google' => sub {\nredirect client->authorizeurl;\n};\n\n# User has returned with token and verifier appended to the URL.\nget '/auth/google/callback' => sub {\n\n# Use the auth code to fetch the access token\nmy $accesstoken =  client->getaccesstoken(params->{oauthtoken}, params->{oauthverifier});\n\n# Use the access token to fetch a protected resource\nmy $response = $accesstoken->get('/m8/feeds/contacts/default/full');\n\n# Do something with said resource...\n\nif ($response->issuccess) {\nreturn \"Yay, it worked: \" . $response->decodedcontent;\n}\nelse {\nreturn \"Error: \" . $response->statusline;\n}\n};\n\ndance;\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Net::OAuth::Client represents an OAuth client or consumer.\n\nWARNING: Net::OAuth::Client is alpha code. The rest of Net::OAuth is quite stable but this\nparticular module is new, and is under-documented and under-tested.\n",
            "subsections": []
        },
        "METHODS": {
            "content": "",
            "subsections": [
                {
                    "name": "new",
                    "content": "Create a new Client\n\n*   $clientid\n\nAKA Consumer Key - you get this from the service provider when you register your\napplication.\n\n*   $clientsecret\n\nAKA Consumer Secret - you get this from the service provider when you register your\napplication.\n\n*   $params{site}\n\n*   $params{requesttokenpath}\n\n*   $params{authorizepath}\n\n*   $params{accesstokenpath}\n\n*   $params{callback}\n\n*   $params{session}\n"
                }
            ]
        },
        "LICENSE AND COPYRIGHT": {
            "content": "Copyright 2011 Keith Grennan.\n\nThis program is free software; you can redistribute it and/or modify it under the terms of\neither: the GNU General Public License as published by the Free Software Foundation; or the\nArtistic License.\n\nSee http://dev.perl.org/licenses/ for more information.\n",
            "subsections": []
        }
    },
    "summary": "Net::OAuth::Client - OAuth 1.0A Client",
    "flags": [],
    "examples": [],
    "see_also": []
}