diff --git a/Koha/REST/V1/Auth.pm b/Koha/REST/V1/Auth.pm index 1b2a9c090b..b04fcaeb62 100644 --- a/Koha/REST/V1/Auth.pm +++ b/Koha/REST/V1/Auth.pm @@ -81,8 +81,8 @@ sub under { "Configuration prevents the usage of this endpoint by unprivileged users"); } - if ( $c->req->url->to_abs->path eq '/api/v1/oauth/token' ) { - # Requesting a token shouldn't go through the API authentication chain + if ( $c->req->url->to_abs->path =~ m#^/api/v1/oauth/# || $c->req->url->to_abs->path =~ m#^/api/v1/public/oauth/#) { + # Requesting OAuth endpoints shouldn't go through the API authentication chain $status = 1; } elsif ( $namespace eq '' or $namespace eq '.html' ) {