shlinkio / shlink-web-client

A React-based client application for Shlink
https://app.shlink.io
MIT License
299 stars 81 forks source link

x-api-key - use Title Case instead of lowercase #322

Closed Shimakuchi closed 4 years ago

Shimakuchi commented 4 years ago

No that I know about the API 😜 ...

The Screenshot says "x-api-key" but it has to be "X-Api-Key". Did not work with lowercase Bildschirmfoto 2020-10-05 um 10 04 08

https://shlink.io/documentation/integrations/short-menu-mac/

acelaya commented 4 years ago

If that's the case, then it's a bug. Headers should not be case-sensitive.

I will investigate what could be the reason.

Shimakuchi commented 4 years ago

Thanks.

The API response ...

<?xml version="1.0"?>
<problem xmlns="urn:ietf:rfc:7807">
    <expectedTypes>
        <_>X-Api-Key</_>
    </expectedTypes>
    <title>Invalid authorization</title>
    <type>INVALID_AUTHORIZATION</type>
    <status>401</status>
    <detail>Expected one of the following authentication headers, ["X-Api-Key"], but none were provided</detail>
</problem>
acelaya commented 4 years ago

Ok, I think I know where the issue might be.

acelaya commented 4 years ago

I have just verified that it works regardless the casing, therefore, you probably didn't configre the header properly. It works with any combination of uppercase and lowercase.

The error above only happens if you don't send the header at all.

BTW, try not reporting shlink issues in shlink-web-client. This is the proper repository for those: https://github.com/shlinkio/shlink