View | Details | Raw Unified | Return to bug 31378
Collapse All | Expand All

(-)a/Koha/REST/V1/OAuth/Client.pm (-2 / +4 lines)
Lines 51-64 sub login { Link Here
51
    my $provider_config = $c->oauth2->providers->{$provider};
51
    my $provider_config = $c->oauth2->providers->{$provider};
52
52
53
    my $uri;
53
    my $uri;
54
    my $base_url;
54
55
55
    if ( $interface eq 'opac' ) {
56
    if ( $interface eq 'opac' ) {
57
        $base_url = C4::Context->preference('OPACBaseURL');
56
        if ( C4::Context->preference('OpacPublic') ) {
58
        if ( C4::Context->preference('OpacPublic') ) {
57
            $uri = '/cgi-bin/koha/opac-user.pl';
59
            $uri = '/cgi-bin/koha/opac-user.pl';
58
        } else {
60
        } else {
59
            $uri = '/cgi-bin/koha/opac-main.pl';
61
            $uri = '/cgi-bin/koha/opac-main.pl';
60
        }
62
        }
61
    } else {
63
    } else {
64
        $base_url = C4::Context->preference('staffClientBaseURL');
62
        $uri = '/cgi-bin/koha/mainpage.pl';
65
        $uri = '/cgi-bin/koha/mainpage.pl';
63
    }
66
    }
64
67
Lines 73-79 sub login { Link Here
73
        $provider_config->{authorize_url} = $authorize_url->to_string;
76
        $provider_config->{authorize_url} = $authorize_url->to_string;
74
    }
77
    }
75
78
76
    return $c->oauth2->get_token_p($provider)->then(
79
    return $c->oauth2->get_token_p( $provider, { redirect_uri => $base_url . '/api/v1/public/oauth/login/' . $provider . "/" . $interface } )->then(
77
        sub {
80
        sub {
78
            return unless my $response = shift;
81
            return unless my $response = shift;
79
82
80
- 

Return to bug 31378