Skip to content
This repository has been archived by the owner on Jan 22, 2019. It is now read-only.

Commit

Permalink
Fix OAuth issue with non-standard port (#28)
Browse files Browse the repository at this point in the history
Contributed by @unickuity. Fixes #27, #29. Closes #28.
  • Loading branch information
a3f committed Oct 26, 2017
1 parent 570c26d commit aafa606
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions Changes
Expand Up @@ -6,6 +6,7 @@
- Add test for Format::Text middleware (#42, gempesaw)
- Proper handling of UTF-8 content in query string escaping
- Support for path with question marks in spore specs (Alexis Sukrieh / Weborama)
- Fix OAuth issue with non-standard port (#28, unickuity)

0.07 Mon Oct 23 22:01::37 2017
- Update files to reflect repository migration
Expand Down
14 changes: 10 additions & 4 deletions lib/Net/HTTP/Spore/Middleware/Auth/OAuth.pm
Expand Up @@ -54,10 +54,14 @@ sub call {
foreach my $k ( keys %$oauth_params ) {
$oauth_params->{$k} = uri_escape( $oauth_params->{$k} );
}

# save the environment so the request will no be finalized twice
my $env = $req->env;
$req->finalize;

my $oauth_sig = $self->_oauth_sig( $req, $oauth_params );
# put back the environment the signature is now computed
$req->env($env);

$req->header( 'Authorization' =>
$self->_build_auth_string( $oauth_params, $oauth_sig ) );
}
Expand Down Expand Up @@ -106,9 +110,11 @@ sub _base_string {

my $uri =
( $scheme || 'https' ) . "://"
. $req->env->{SERVER_NAME}
. $req->env->{SCRIPT_NAME}
. $req->env->{PATH_INFO};
. $req->env->{SERVER_NAME};
if ( $port ) { $uri .= ":$port"; }
$uri .= $req->env->{SCRIPT_NAME}
. $req->env->{PATH_INFO};


foreach my $k (keys %$oparams){
push @$query_keys, $k;
Expand Down

0 comments on commit aafa606

Please sign in to comment.