Skip to content

Commit

Permalink
Removed fix_get_token hack
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Henning Thorsen committed Sep 8, 2015
1 parent a29d713 commit e1da641
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 15 deletions.
6 changes: 5 additions & 1 deletion Changes
@@ -1,4 +1,8 @@
1.52 Mon Apr 6 22:45:17 2015

1.53 Not Released
- Removed fix_get_token hack

1.52 2015-04-06 22:45:17
- Add oauth2->get_token() works in blocking mode (Alexander Karelas)

1.51 2015-03-18 17:38:19
Expand Down
14 changes: 6 additions & 8 deletions lib/Mojolicious/Plugin/OAuth2.pm
Expand Up @@ -53,11 +53,6 @@ sub register {

$self->providers($providers);

unless ($self->{fix_get_token} = $config->{fix_get_token}) {
deprecated
"\$c->oauth2->get_token(...) has changed api! Please set 'fix_get_token' in the config arguments to move forward. Sorry for the inconvenience.";
}

if ($providers->{mocked}{key}) {
$self->_mock_interface($app);
}
Expand Down Expand Up @@ -222,9 +217,7 @@ sub _process_response_code {
$data = Mojo::Parameters->new($tx->res->body)->to_hash;
}

$err = $data ? '' : $err || 'Unknown error';

$c->$cb($err, $self->{fix_get_token} ? $data : $data->{access_token});
$c->$cb($data ? '' : $err || 'Unknown error', $data);
},
);
}
Expand Down Expand Up @@ -316,6 +309,11 @@ L<IO::Socket::SSL> is installed.
$ mojo version
=head2 Breaking changes
Between 1.51 (2015-03-18) and 1.53 (2015-09-08) we decided to remove the back
compat hack for L</get_token>, making it act I<only> as documented.
=head2 References
=over 4
Expand Down
3 changes: 1 addition & 2 deletions t/Helper.pm
Expand Up @@ -9,8 +9,7 @@ sub make_app {

$app->plugin(
OAuth2 => {
fix_get_token => 1,
test => {
test => {
authorize_url => '/oauth/authorize',
token_url => '/oauth/token',
key => 'fake_key',
Expand Down
2 changes: 1 addition & 1 deletion t/get_authorize_url.t
Expand Up @@ -5,7 +5,7 @@ use Test::More;
my $authorize_args = {};

use Mojolicious::Lite;
plugin 'OAuth2' => {fix_get_token => 1, facebook => {key => 'KEY'}};
plugin 'OAuth2' => {facebook => {key => 'KEY'}};
get '/test123', sub { $_[0]->render(text => $_[0]->get_authorize_url('facebook', $authorize_args)); };

my $t = Test::Mojo->new;
Expand Down
2 changes: 1 addition & 1 deletion t/mocked.t
Expand Up @@ -5,7 +5,7 @@ use Test::More;

{
use Mojolicious::Lite;
plugin OAuth2 => {fix_get_token => 1, mocked => {key => '42'}};
plugin OAuth2 => {mocked => {key => '42'}};
get '/test123' => sub {
my $c = shift;

Expand Down
2 changes: 1 addition & 1 deletion t/mocked_blocking.t
Expand Up @@ -5,7 +5,7 @@ use Test::More;

{
use Mojolicious::Lite;
plugin OAuth2 => {fix_get_token => 1, mocked => {key => '42'}};
plugin OAuth2 => {mocked => {key => '42'}};
get '/test123' => sub {
my $c = shift;

Expand Down
2 changes: 1 addition & 1 deletion t/oauth2-auth_url.t
Expand Up @@ -5,7 +5,7 @@ use Test::More;
my $authorize_args = {};

use Mojolicious::Lite;
plugin 'OAuth2' => {fix_get_token => 1, facebook => {key => 'KEY'}};
plugin 'OAuth2' => {facebook => {key => 'KEY'}};
get '/test123', sub { $_[0]->render(text => $_[0]->oauth2->auth_url('facebook', $authorize_args)); };

my $t = Test::Mojo->new;
Expand Down

0 comments on commit e1da641

Please sign in to comment.