So I'm doing a POST request to github as part of an OAuth web flow authentication. (This is part of a sub in a Dancer app).
I use LWP::UserAgent::post() and the docs I linked to seem to say that method will return a HTTP::Response object. But I get a weird type.
When I send a post to github for the access_token is where I have a slight problemo:
my $code = params->{'code'};
my $browser = LWP::UserAgent->new;
my $resp = $browser.post('https://github.com/login/oauth/access_token'
+,
[
client_id =>'<my client id>'
client_secret => '<my secret>',
code => $code,#the code I got in the param
state => '<some state>'
]);
#HERE>>>>>>>>>>>>>>>>>>>>
# I cannot seem to figure what $resp is!??
#----- $resp->is_success doesn't work!
return Dumper($resp);
Issues
- If I use $resp->is_success then I get Can't locate object method "is_success"
- With the Data::Dumper I get the following response: $VAR1 = 'LWP::UserAgent=HASH(0x7fd8da50a690)Dancer::Route=HASH(0x7fd8da4dd6a8)';
Any ideas?? How should I go an inspect the object that is returned.? Am I getting two objects here?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.