6

我正在尝试获取电子邮件地址。成功登录后,我有名字,姓氏,除了电子邮件。请帮忙。

VK.Auth.login(function (response) {
            if (response.session) {


            } else {

            }
        }, 4194304);
4

5 回答 5

7

当您获得访问令牌时,VK 还会为您提供电子邮件和用户 ID,但您需要特定的权限 - “电子邮件”。

于 2015-04-10T10:04:17.980 回答
1

vk.com 现在具有该功能。尝试查看此文档页面:https ://vk.com/dev/permissions

于 2015-01-06T15:20:51.660 回答
1

是的,这种方式不给电子邮件。但是有通过 OAuth 获取电子邮件的方法(对于站点 vk.com/dev/auth_sites),电子邮件将在 GET 参数中与令牌一起返回。

在 Coffescript/Javascript 你可以使用 window.open(...)

appId = 'your app id'
redirectUri = 'your redirect uri'
url = 'https://oauth.vk.com/authorize?client_id='+appId+'&display=popup&redirect_uri='+redirectUri+'&response_type=token&scope=email'

newWin = window.open(url, 'vk-login', 'width=665,height=370')

后来你有两种方式来获取电子邮件

  1. 关于重定向 uri 处理程序(服务器方式)
  2. 重定向到您网站的任何地方,并每隔一秒检查一次 newWin.location.href a if (newHref.indexOf(redirectUri) != -1) 然后提取参数电子邮件(客户端方式)
于 2016-04-29T07:19:44.030 回答
0

你可以使用 window.open

var url = 'https://oauth.vk.com/authorize?client_id=APP_ID&scope=email&redirect_uri=http://yoursite.com&response_type=token'

        var newWin = window.open(url, 'vk-login', 'width=665,height=370')
        newWin.onload = function() {
          var hash = newWin.location.hash
          console.log(hash)
        }
于 2017-01-27T10:37:15.363 回答
-1

没有办法做到这一点。Vk 是特定的社交网络。

于 2014-09-18T10:17:18.467 回答