I
I
Ivan Yakushenko2019-04-25 16:09:53
Python
Ivan Yakushenko, 2019-04-25 16:09:53

Why is authorization by VK API token not happening?

The token was received in group management, here is the code:

vk_session = vk_api.VkApi(token='###########')
longpoll = VkLongPoll(vk_session)
vk = vk_session.get_api()
try:
    vk_session.auth(token_only=True)
except vk_api.AuthError as error_msg:
    print(error_msg)

Error on startup:
Login is required to auth

I tried to substitute the token received on the vkhost website from the Kate Mobie application, the result is the same.
I tried just by login and password, then the error is as follows:
vk_api.exceptions.ApiError: [5] User authorization failed: no access_token passed.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2019-04-25
@kshnkvn

When passing a token , you do not need to call vk_session.auth

vk_session = vk_api.VkApi(token='токен')
vk = vk_session.get_api()
longpoll = VkLongPoll(vk_session)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question