P
P
Pavel Pavel2020-12-06 15:04:10
Python
Pavel Pavel, 2020-12-06 15:04:10

How to make vk_api authorization by login and password for longpoll?

You need to authorize with a password and login to use longpoll .
Here is what I have:

vk_session = vk_api.VkApi(login, password)
    vk_session.auth()
    token = vk_session.token["access_token"]


but when calling longpoll, an error appears:
vk_api.exceptions.ApiError: [15] Access denied: no access to call this method


I thought it was possible through Standalone applications, but it's dreary, as for me.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
nochangez, 2020-12-09
@nochangez

vk_session = vk_api.VkApi(token='<TOKEN>')
session_api = vk_session.get_api()
longpoll = VkLongPoll(vk_session)
vk = vk_session.get_api()

you can get a token from official applications (Kate mobile, vk coin, etc.) link to get a token

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question