line / line-bot-sdk-python

LINE Messaging API SDK for Python
https://pypi.python.org/pypi/line-bot-sdk
Apache License 2.0
1.87k stars 962 forks source link

it seems like there is no way to issue ChannelAccessToken with this SDK #587

Closed killinsun closed 5 months ago

killinsun commented 5 months ago

Hello. I am integrating LINE API with this SDK into my product.

According to ChannelAccessToken class, it requires Configuration class and it also requires channel_access_token I think this specification is inconsistent and requires an access token to issue an access token 🤯

How can I issue ChannelAccessToken v2.1 from this class? If I take a look at the node.js SDK, it doesn't need any tokens for this endpoint. https://github.com/line/line-bot-sdk-nodejs/blob/master/lib/channel-access-token/api/channelAccessTokenClient.ts

Did I miss something?

 File "my_project/line_sdk_wrapper.py", line 14, in issue_channel_access_token
    line_channel_access_token = LineChannelAccessToken()
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "my_project/.venv/lib/python3.11/site-packages/linebot/v3/oauth/api/channel_access_token.py", line 47, in __init__
    api_client = ApiClient.get_default()
                 ^^^^^^^^^^^^^^^^^^^^^^^
  File "my_project/.venv/lib/python3.11/site-packages/linebot/v3/oauth/api_client.py", line 133, in get_default
    cls._default = ApiClient()
                   ^^^^^^^^^^^
  File "my_project/venv/lib/python3.11/site-packages/linebot/v3/oauth/api_client.py", line 77, in __init__
    self.default_headers['Authorization'] = 'Bearer ' + configuration.access_token
                                            ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
TypeError: can only concatenate str (not "NoneType") to str

Thanks.

Yang-33 commented 5 months ago

which version of line-bot-sdk-python do you use?

Yang-33 commented 5 months ago

If I understand this correctly, line-bot-sdk-python >= 3.5.1 won't require Authorization header. (code) Thus access_token is not necessary for now.

killinsun commented 5 months ago

@Yang-33 Thanks for the prompt reply!

If I understand this correctly, line-bot-sdk-python >= 3.5.1 won't require Authorization header. (code) Thus access_token is not necessary for now.

Ah, I'm using line-bot-sdk = "3.1.0" so I will consider upgrade the sdk. Thank you.