livechat / lc-sdk-python

https://pypi.org/project/lc-sdk-python/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The `token` for the `ConfigurationApi` needs to include the BEARER or BASIC in the string. This is unexpected.

ttamg opened this issue · comments

I was having issues with the ConfigurationApi authenticating until I realised that the token was expecting the full auth headers string. This is not what I think people expect. Usually I would expect the API to add in the BEARER or BASIC part of the header.

Here is an example showing the issue:

When using a personal access token, it uses BASIC auth so the following works:

  personal_access_token = input("Enter the personal access token for this app: ")
  token = f"Basic {personal_access_token}"
  configuration_api = ConfigurationApi.get_client(token=token)

When using an access token the following works:

  access_token = input("Enter the user bearer access token ")
  token = f"Bearer {access_token}"
  configuration_api = ConfigurationApi.get_client(token=token)

I would expect the API to take the pure token as the token and then perhaps a token_type: Literal['Bearer', 'Basic'] = 'Bearer' or something like that as an optional parameter that would build the string under the hood.

This is a breaking change if you make it. I want to flag.

Hi @ttamg , thanks very much for raising this. Indeed, token type should not be implicitly passed inside of token string. We'll add a solution with an aim to keep backwards compatibility in v0.4.0.

finally resolved in the latest release (0.3.9)