HumanSignal / HumanSignal/label-studio-sdk

Encounter 401 when call `download_and_cache`.

Open
#475 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
192
Forks
127
Avg merge
1d 18h
Merged PRs (30d)
1

Description

Hello,

I noticed that in this line of code https://github.com/HumanSignal/label-studio-sdk/blob/855b393d63e26a750a1e0ecad8a616313afa9f4a/src/label_studio_sdk/_extensions/label_studio_tools/core/utils/io.py#L233, the `Authorization` header uses the `Token` scheme. However, according to the [documentation](https://labelstud.io/guide/api.html#Authenticate-to-the-API), the correct scheme should be `Bearer`.

I tried the following command using `Token`:

```bash
curl -X GET / -H 'Authorization: Token '
```

And received this response:

```json
{
"id": "581f9ced-c880-42c6-af7b-6e1851367db6",
"status_code": 401,
"version": "1.19.0",
"detail": "Invalid token.",
"exc_info": null
}
```

But when I switched to using `Bearer`:

```bash
curl -X GET / -H 'Authorization: Bearer '
```

It seemed to work correctly (though I received a warning about binary output, which is expected).

So my question is:
Should the SDK be using `Token` in the `Authorization` header, or is `Bearer` the correct and intended format?

Thanks in advance!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.