diff options
author | gregor herrmann <gregoa@debian.org> | 2021-02-20 18:30:38 +0100 |
---|---|---|
committer | gregor herrmann <gregoa@debian.org> | 2021-02-20 18:30:38 +0100 |
commit | 6c4bbfe4a930b2cf0f0ab558e376b762a0a0e9f2 (patch) | |
tree | f6ca31d8568122a01146156edad57cac395e30b6 | |
parent | 455abc04b153163cf3ed825424afdd5f0442b46d (diff) | |
parent | aa4a590712e80650419055d2d9f89ea56857c7cc (diff) |
Update upstream source from tag 'upstream/1.59'
Update to upstream version '1.59'
with Debian dir 6fb4dcf5f2a74cf3d6b196ae070ec9da49fe49a1
-rw-r--r-- | Changes | 5 | ||||
-rw-r--r-- | META.json | 6 | ||||
-rw-r--r-- | META.yml | 4 | ||||
-rw-r--r-- | Makefile.PL | 1 | ||||
-rw-r--r-- | README.md | 12 | ||||
-rw-r--r-- | lib/Mojolicious/Plugin/OAuth2.pm | 13 | ||||
-rw-r--r-- | t/delayed.t | 24 |
7 files changed, 27 insertions, 38 deletions
@@ -1,5 +1,10 @@ Revision history for perl distribution Mojolicious-Plugin-OAuth2 +1.59 2021-02-17T08:33:17+0900 + - Fix invalid "=item" in documentation. + - Compatible with Mojolicious 9.0 + Contributor: Joel Berger + 1.58 2019-07-03T14:22:38+0200 - Add new Oauth2 providers: instagram.com - Add new Oauth2 providers: vk.com @@ -4,7 +4,7 @@ "Jan Henning Thorsen <jhthorsen@cpan.org>" ], "dynamic_config" : 0, - "generated_by" : "ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010", + "generated_by" : "ExtUtils::MakeMaker version 7.44, CPAN::Meta::Converter version 2.150010", "license" : [ "artistic_2" ], @@ -52,10 +52,10 @@ "web" : "https://github.com/marcusramberg/Mojolicious-Plugin-OAuth2" } }, - "version" : "1.58", + "version" : "1.59", "x_contributors" : [ "Marcus Ramberg <mramberg@cpan.org>", "Jan Henning Thorsen <jhthorsen@cpan.org>" ], - "x_serialization_backend" : "JSON::PP version 2.97001" + "x_serialization_backend" : "JSON::PP version 4.04" } @@ -7,7 +7,7 @@ build_requires: configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 0 -generated_by: 'ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010' +generated_by: 'ExtUtils::MakeMaker version 7.44, CPAN::Meta::Converter version 2.150010' license: artistic_2 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -24,7 +24,7 @@ resources: bugtracker: https://github.com/marcusramberg/Mojolicious-Plugin-OAuth2/issues homepage: https://github.com/marcusramberg/Mojolicious-Plugin-OAuth2 repository: https://github.com/marcusramberg/Mojolicious-Plugin-OAuth2.git -version: '1.58' +version: '1.59' x_contributors: - 'Marcus Ramberg <mramberg@cpan.org>' - 'Jan Henning Thorsen <jhthorsen@cpan.org>' diff --git a/Makefile.PL b/Makefile.PL index 1bfa634..ba61ada 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -8,6 +8,7 @@ my %WriteMakefileArgs = ( ABSTRACT_FROM => 'lib/Mojolicious/Plugin/OAuth2.pm', VERSION_FROM => 'lib/Mojolicious/Plugin/OAuth2.pm', EXE_FILES => [qw()], + OBJECT => '', BUILD_REQUIRES => {} , TEST_REQUIRES => { @@ -10,7 +10,7 @@ popular providers, but you can add your own easily as well. Note that OAuth2 requires https, so you need to have the optional Mojolicious dependency required to support it. Run the command below to check if -[IO::Socket::SSL](https://metacpan.org/pod/IO::Socket::SSL) is installed. +[IO::Socket::SSL](https://metacpan.org/pod/IO%3A%3ASocket%3A%3ASSL) is installed. $ mojo version @@ -69,7 +69,7 @@ values are configuration for each provider. Here is a complete example: }, }; -To make it a bit easier, [Mojolicious::Plugin::OAuth2](https://metacpan.org/pod/Mojolicious::Plugin::OAuth2) has already +To make it a bit easier, [Mojolicious::Plugin::OAuth2](https://metacpan.org/pod/Mojolicious%3A%3APlugin%3A%3AOAuth2) has already values for `authorize_url` and `token_url` for the following providers: - dailymotion @@ -90,7 +90,7 @@ values for `authorize_url` and `token_url` for the following providers: See also [https://developers.facebook.com/docs/reference/dialogs/oauth/](https://developers.facebook.com/docs/reference/dialogs/oauth/). - = item \* instagram +- instagram OAuth2 for Instagram API. You can find `key` (Client ID) and `secret` (Client Secret) from the app dashboard here: @@ -112,7 +112,7 @@ values for `authorize_url` and `token_url` for the following providers: See also [https://developers.google.com/+/quickstart/](https://developers.google.com/+/quickstart/). - = item \* vkontakte +- vkontakte OAuth2 for Vkontakte. You can find `key` (App ID) and `secret` (Secure key) from the app dashboard here: [https://vk.com/apps?act=manage](https://vk.com/apps?act=manage). @@ -160,7 +160,7 @@ The code above will add two new routes to your application: $url = $c->oauth2->auth_url($provider => \%args); -Returns a [Mojo::URL](https://metacpan.org/pod/Mojo::URL) object which contain the authorize URL. This is +Returns a [Mojo::URL](https://metacpan.org/pod/Mojo%3A%3AURL) object which contain the authorize URL. This is useful if you want to add the authorize URL as a link to your webpage instead of doing a redirect like ["oauth2.get\_token"](#oauth2-get_token) does. `%args` is optional, but can contain: @@ -245,7 +245,7 @@ when [registering](#synopsis) the plugin. $promise = $c->oauth2->get_token_p($provider_name => \%args); -Same as ["oauth2.get\_token"](#oauth2-get_token), but returns a [Mojo::Promise](https://metacpan.org/pod/Mojo::Promise). See ["SYNOPSIS"](#synopsis) +Same as ["oauth2.get\_token"](#oauth2-get_token), but returns a [Mojo::Promise](https://metacpan.org/pod/Mojo%3A%3APromise). See ["SYNOPSIS"](#synopsis) for example usage. ## oauth2.providers diff --git a/lib/Mojolicious/Plugin/OAuth2.pm b/lib/Mojolicious/Plugin/OAuth2.pm index 94c27d2..5f5e06d 100644 --- a/lib/Mojolicious/Plugin/OAuth2.pm +++ b/lib/Mojolicious/Plugin/OAuth2.pm @@ -6,7 +6,7 @@ use Mojo::UserAgent; use Carp 'croak'; use strict; -our $VERSION = '1.58'; +our $VERSION = '1.59'; has providers => sub { return { @@ -34,10 +34,7 @@ has providers => sub { authorize_url => "https://accounts.google.com/o/oauth2/v2/auth?response_type=code", token_url => "https://www.googleapis.com/oauth2/v4/token", }, - vkontakte => { - authorize_url => "https://oauth.vk.com/authorize", - token_url => "https://oauth.vk.com/access_token", - }, + vkontakte => {authorize_url => "https://oauth.vk.com/authorize", token_url => "https://oauth.vk.com/access_token",}, mocked => {authorize_url => '/mocked/oauth/authorize', token_url => '/mocked/oauth/token', secret => 'fake_secret'}, }; }; @@ -92,7 +89,7 @@ sub _get_authorize_url { my $provider_args = $self->providers->{$args->{provider}}; my $authorize_url; - $args->{scope} ||= $provider_args->{scope}; + $args->{scope} ||= $provider_args->{scope}; $args->{redirect_uri} ||= $c->url_for->to_abs->to_string; $authorize_url = Mojo::URL->new($provider_args->{authorize_url}); $authorize_url->host($args->{host}) if exists $args->{host}; @@ -301,7 +298,7 @@ L<https://developers.facebook.com/apps>. See also L<https://developers.facebook.com/docs/reference/dialogs/oauth/>. -= item * instagram +=item * instagram OAuth2 for Instagram API. You can find C<key> (Client ID) and C<secret> (Client Secret) from the app dashboard here: @@ -323,7 +320,7 @@ OAuth2 for Google. You can find the C<key> (CLIENT ID) and C<secret> See also L<https://developers.google.com/+/quickstart/>. -= item * vkontakte +=item * vkontakte OAuth2 for Vkontakte. You can find C<key> (App ID) and C<secret> (Secure key) from the app dashboard here: L<https://vk.com/apps?act=manage>. diff --git a/t/delayed.t b/t/delayed.t index 6bcd2d8..83f562d 100644 --- a/t/delayed.t +++ b/t/delayed.t @@ -6,29 +6,15 @@ my $t = Test::Mojo->new($app); Mojo::Util::monkey_patch('Mojolicious::Plugin::OAuth2', _ua => sub { $t->ua }); -$t->app->helper( - delay => sub { - my $c = shift; - my $tx = $c->render_later->tx; - Mojo::IOLoop->delay(@_)->catch(sub { $c->helpers->reply->exception(pop) and undef $tx })->wait; - } -); - $app->routes->get( '/oauth-delayed' => sub { my $c = shift; - $c->delay( - sub { - my $delay = shift; - $c->oauth2->get_token(test => $delay->begin); - }, - sub { - my ($delay, $err, $provider_res) = @_; - return $c->render(text => $err) unless $provider_res; - return $c->render(text => "Token $provider_res->{access_token}"); - }, - ); + $c->oauth2->get_token(test => sub { + my (undef, $err, $provider_res) = @_; + return $c->render(text => $err) unless $provider_res; + return $c->render(text => "Token $provider_res->{access_token}"); + }); } ); |