Skip Menu |

This queue is for tickets about the Reddit-Client CPAN distribution.

Report information
The Basics
Id: 110585
Status: new
Priority: 0/
Queue: Reddit-Client

Owner: Nobody in particular
Requestors: davidnmfarrell [...]

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

Subject: Encode token requests
Date: Thu, 24 Dec 2015 10:53:14 -0500
To: bug-Reddit-Client [...]
From: David Farrell <davidnmfarrell [...]>
Reddit::Client::Request::token_request does not percent encode the form content before submitting to Reddit. This causes the authentication to fail when a user's credentials include URI reserved characters. (the HTTP request succeeds but the JSON returned just contains an error message). Here is a patched sub: sub token_request { my ($self, $client_id, $secret, $username, $password, $useragent) = @_; my $url = "https://$client_id:$secret\ "; my $ua = LWP::UserAgent->new(user_agent => $useragent); my $req = HTTP::Request->new(POST => $url); $req->header('content-type' => 'application/x-www-form-urlencoded'); my $encoder = URI::Encode->new( {encode_reserved => 1 }); my $postdata = sprintf('grant_type=password&username=%s&password=%s', $encoder->encode($username), $encoder->encode($password) ); $req->content($postdata); my $res = $ua->request($req); if ($res->is_success) { return $res->decoded_content; } else { croak sprintf('Request error: HTTP %s', $res->status_line); }

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to