[Koha] Koha rest API OAuth authentication fails

Ere Maijala ere.maijala at helsinki.fi
Mon Dec 18 21:03:44 NZDT 2023


If you didn't get it to work already, I'd start by checking that the 
server has the Net::OAuth2::AuthorizationServer cpan module installed 
(minimum version 0.16). You may also need to change the Apache server 
configuration to make it pass the Authorization header through to Koha 
by adding this to the relevant configuration:

SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0

Best,
Ere

On 1.12.2023 19.50, Coehoorn, Joel wrote:
> I asked a question yesterday about API access to setup EBSCO catalog sync,
> and that is moving forward now, as they will be using the public API.
>
> While working on that I also spent some time looking at the other API
> endpoints. I am able to use the authenticated APIs, but only if I login via
> our normal SAML SSO process first and then make the API calls on the
> authenticated session. I would like to eventually be able to use OAuth for
> some things here. However, I was not able to make OAuth work.
>
> Specifically, I am able to successfully request a token and set it with
> "Bearer " in the Authorization header, but no matter what I try I get 401
> response with {"error":"Authentication failure."}.  I've tried powershell
> and Postman from my own machine, and curl while logged into the koha server
> directly, but nothing I do seems to change anything.
>
> The user owning the API keys used with the request definitely has the
> needed permissions, and I even tried issuing an API key for a
> superlibrarian just to be sure. The RestPublicAPI
> and RESTOAuth2ClientCredentials system preferences are both enabled.
>
> What could I be missing?
>
> *Joel Coehoorn*
> Director of Information Technology
> *York University*
> Office: 402-363-5603 | jcoehoorn at york.edu | york.edu
>
> *Please contact helpdesk at york.edu <helpdesk at york.edu> for technical
> assistance.*
>
>
> The mission of York University is to transform lives through
> Christ-centered education and to equip students for lifelong service to
> God, family, and society
> _______________________________________________
>
> Koha mailing list  http://koha-community.org
> Koha at lists.katipo.co.nz
> Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha

-- 
Ere Maijala
Kansalliskirjasto / The National Library of Finland



More information about the Koha mailing list