Subject: | wrong behaviour of the encode_base64 |
When get_access_token() adding header "Autorization Basic ..." it uses encode_base64() which has a feature to broke long encoded lines by 76 characters with delimeter "\n". So we get wrong header Authorization and get_access_token() fails when trying to request access_token from provider.
There is a simple solution to resolve this issue. See attached patch.
Subject: | encode_base64_issue.patch |
diff -ur Net-OAuth2-0.55/lib/Net/OAuth2/Profile/WebServer.pm Net-OAuth2-0.55-1/lib/Net/OAuth2/Profile/WebServer.pm
--- Net-OAuth2-0.55/lib/Net/OAuth2/Profile/WebServer.pm 2013-04-02 14:13:41.000000000 +0000
+++ Net-OAuth2-0.55-1/lib/Net/OAuth2/Profile/WebServer.pm 2013-09-04 09:28:13.000000000 +0000
@@ -87,7 +87,7 @@
, $params
);
- my $basic = encode_base64 "$params->{client_id}:$params->{client_secret}";
+ my $basic = encode_base64 "$params->{client_id}:$params->{client_secret}", "";
$request->headers->header(Authorization => "Basic $basic");
my $response = $self->request($request);