0

I am trying to access VK Api with scope of stats. manually i am able to generate access token, but that is going to expire in 24 hours. So i wanted to generate access token programatically. i tried in 2 ways mentioned as below.

first way:

import requests
response=requests.get('https://oauth.vk.com/authorize?client_id=myclientid&scope=stats&redirect_uri= myredirecturi& display=page&v=5.53&response_type=token ')
print r.url (my expectation is it should give that redirect url with access token, but that is returning url which i am passing as argument.)

second method:

import vk
session=vk.AuthSession(app_id='myappid', user_login='myusername', user_password='mypassword')
api = vk.API(session)

returning Vkauth error 'redirect_uri' mismatch. Can anyone suggest how to solve this and how to get access token automatically.

Tom
  • 445
  • 1
  • 4
  • 10
Testing_GA
  • 1
  • 1
  • 2

1 Answers1

0

Look at the way of authorizing I described in that post. It's called 'straight auth' which is used by official VK applications for iOS/Android/etc, that token has grant rights and no limit for its lifetime value.

Community
  • 1
  • 1
SwiftStudier
  • 2,272
  • 5
  • 21
  • 43