From 8c563786c9842cd33eacb371b48f21acb7218043 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 7 Oct 2022 14:50:46 +0000 Subject: [PATCH] Bug 31378: Use base URLs for redirect uri Signed-off-by: Katrin --- Koha/REST/V1/OAuth/Client.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Koha/REST/V1/OAuth/Client.pm b/Koha/REST/V1/OAuth/Client.pm index 36cca8aac6..ca63d00748 100644 --- a/Koha/REST/V1/OAuth/Client.pm +++ b/Koha/REST/V1/OAuth/Client.pm @@ -67,18 +67,22 @@ sub login { } my $uri; + my $base_url; if ( $interface eq 'opac' ) { + $base_url = C4::Context->preference('OPACBaseURL'); if ( C4::Context->preference('OpacPublic') ) { $uri = '/cgi-bin/koha/opac-user.pl'; } else { $uri = '/cgi-bin/koha/opac-main.pl'; } } else { + $base_url = C4::Context->preference('staffClientBaseURL'); $uri = '/cgi-bin/koha/mainpage.pl'; } - return $c->oauth2->get_token_p($provider)->then( + + return $c->oauth2->get_token_p( $provider, { redirect_uri => $base_url . '/api/v1/public/oauth/login/' . $provider . "/" . $interface } )->then( sub { return unless my $response = shift; -- 2.30.2