From e0a8dfae95ee20467f671ce1874ae2e3fb65048d Mon Sep 17 00:00:00 2001 From: Stas Kravets Date: Wed, 26 Jun 2013 19:56:18 +0300 Subject: [PATCH] Fixing VK APP authentication and app page text with new VKAPP_* settings --- example/example/templates/vkontakte_app.html | 5 ++--- social_auth/backends/contrib/vk.py | 5 +++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/example/example/templates/vkontakte_app.html b/example/example/templates/vkontakte_app.html index cc5a3f36c..c0a58c24f 100644 --- a/example/example/templates/vkontakte_app.html +++ b/example/example/templates/vkontakte_app.html @@ -35,9 +35,8 @@
  1. Create your IFrame application at VKontakte.
  2. In your application settings specify your IFrame URL mysite.com/vk (current default).
  3. -
  4. Because VKontakte IFrame uses other app ID than OAuth/OpenAPI authentication one, you have to specify it and its secret key in VKONTAKTE_APP_AUTH setting:
  5. -
  6. VKONTAKTE_APP_AUTH={'key':'iframe_app_secret_key', 'user_mode': 2, 'id':'iframe_app_id'}
  7. -
  8. user_mode values
  9. +
  10. Because VK IFrame uses other app ID than OAuth/OpenAPI authentication one, you have to specify it and its secret key in VKAPP_* settings:
  11. +
  12. VKAPP_APP_ID='iframe_app_id', VKAPP_API_SECRET='iframe_app_secret_key', VKAPP_USER_MODE = 'user_mode'
  13. user_mode values
    1. if 0 there will be no check whether a user connected to your application or not
    2. if 1 DSA will check is_app_user parameter VKontakte sends when user opens app page one time
    3. diff --git a/social_auth/backends/contrib/vk.py b/social_auth/backends/contrib/vk.py index 09a9d2b22..2d9d8d226 100644 --- a/social_auth/backends/contrib/vk.py +++ b/social_auth/backends/contrib/vk.py @@ -34,6 +34,8 @@ LOCAL_HTML = setting('VK_LOCAL_HTML', setting('VKONTAKTE_LOCAL_HTML', 'vkontakte.html')) +USE_APP_AUTH = setting('VKAPP_APP_ID', False) + class VKOpenAPIBackend(SocialAuthBackend): """VK OpenAPI authentication backend""" @@ -298,6 +300,5 @@ def vk_api(method, data, is_app=False): # Backend definition BACKENDS = { 'vk-openapi': VKOpenAPIAuth, - 'vk-oauth': VKOAuth2, - 'vk-app': VKAppAuth + 'vk-oauth': VKOAuth2 if not USE_APP_AUTH else VKAppAuth, }