Skip to content

Encounter 401 when call download_and_cache. #475

@Sunhill666

Description

@Sunhill666

Hello,

I noticed that in this line of code

headers["Authorization"] = "Token " + access_token
, the Authorization header uses the Token scheme. However, according to the documentation, the correct scheme should be Bearer.

I tried the following command using Token:

curl -X GET <Label Studio URL>/<endpoint> -H 'Authorization: Token <my-token>'

And received this response:

{
  "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:

curl -X GET <Label Studio URL>/<endpoint> -H 'Authorization: Bearer <my-token>'

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions