@@ -, +, @@ --- Koha/REST/V1/OAuth/Client.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/Koha/REST/V1/OAuth/Client.pm +++ a/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; --