Authorization service with POST (support API version 1.1)
Change-Id: Ia5288c8d0949ed7ee77b5422f10bc19ea8cc3398
diff --git a/lib/Kalamar/Plugin/Auth.pm b/lib/Kalamar/Plugin/Auth.pm
index bdb988d..cf06321 100644
--- a/lib/Kalamar/Plugin/Auth.pm
+++ b/lib/Kalamar/Plugin/Auth.pm
@@ -450,14 +450,19 @@
state $r_url = Mojo::URL->new($c->korap->api)->path('oauth2/authorize');
my $client_id = $param{'client_id'};
-
- return $c->korap_request($no_redirect_ua, post => $r_url, { } => form => {
- response_type => 'code',
- client_id => $client_id,
- redirect_uri => $param{'redirect_uri'},
- state => $param{'state'},
- scope => $param{'scope'},
- })->then(
+
+ my $query = {
+ response_type => 'code',
+ client_id => $client_id,
+ redirect_uri => $param{'redirect_uri'},
+ state => $param{'state'},
+ scope => $param{'scope'},
+ };
+
+ my $url = $r_url->clone->query($query);
+
+ return $c->korap_request($no_redirect_ua, get => $url)
+ ->then(
sub {
my $tx = shift;
diff --git a/t/server/mock.pl b/t/server/mock.pl
index 0aa8a9b..134fb97 100644
--- a/t/server/mock.pl
+++ b/t/server/mock.pl
@@ -848,7 +848,7 @@
);
};
-post '/v1.0/oauth2/authorize' => sub {
+get '/v1.0/oauth2/authorize' => sub {
my $c = shift;
my $type = $c->param('response_type');
my $client_id = $c->param('client_id');