{
    "content": [
        {
            "type": "text",
            "text": "# Net::OAuth::Client (perldoc)\n\n## NAME\n\nNet::OAuth::Client - OAuth 1.0A Client\n\n## SYNOPSIS\n\n# 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;\n\n## DESCRIPTION\n\nNet::OAuth::Client represents an OAuth client or consumer.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **METHODS** (1 subsections)\n- **LICENSE AND COPYRIGHT**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Net::OAuth::Client",
        "section": "",
        "mode": "perldoc",
        "summary": "Net::OAuth::Client - OAuth 1.0A Client",
        "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;",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 48,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "new",
                        "lines": 24
                    }
                ]
            },
            {
                "name": "LICENSE AND COPYRIGHT",
                "lines": 8,
                "subsections": []
            }
        ],
        "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": []
            }
        }
    }
}