I'm testing the vk.com api to be able to perform a search. I can get the token, but when I use it, it always returns the error: "access_token has expired" Please can you give me a hand to see if the code is wrong, or is it a vk configuration?
Thank you very much
import vk
import requests
url = 'https://oauth.vk.com/access_token?client_id=myClient&client_secret=mySecret&v=5.65&grant_type=client_credentials'
request = requests.get(url).json()
access_token = request["access_token"]
session = vk.Session(access_token)
api = vk.API(session)
search = api.search.getHints(q='python')
The error:
File "C:\Users\gabri\AppData\Local\Programs\Python\Python36-32\lib\site-packages\vk\api.py", line 173, in __call__
return self._api._session.make_request(self)
File "C:\Users\gabri\AppData\Local\Programs\Python\Python36-32\lib\site-packages\vk\api.py", line 102, in make_request
raise error
vk.exceptions.VkAPIError: 28. Application authorization failed: access_token has expired.. request_params = {'oauth': '1', 'method': 'search.getHints', 'q': 'python'}