可靠地从LinkedIn Javascript API获取电子邮件

可靠地从LinkedIn Javascript API获取电子邮件,javascript,linkedin,linkedin-jsapi,Javascript,Linkedin,Linkedin Jsapi,渴望可靠地获取用户的电子邮件,LinkedIn的API文档中似乎没有任何与此相关的内容。我有一个cod的工作,它抓住了基本的配置文件,我已经尝试了什么,我可以在网上找到更多的领域。但这不会返回任何内容。代码如下: <script type="text/javascript" src="//platform.linkedin.com/in.js"> api_key: 11111111111 onLoad: onLinkedInLoad authorize: t

渴望可靠地获取用户的电子邮件,LinkedIn的API文档中似乎没有任何与此相关的内容。我有一个cod的工作,它抓住了基本的配置文件,我已经尝试了什么,我可以在网上找到更多的领域。但这不会返回任何内容。代码如下:

<script type="text/javascript" src="//platform.linkedin.com/in.js">
    api_key: 11111111111
    onLoad:  onLinkedInLoad
    authorize: true
    scope: r_basicprofile

  </script>

<script type="text/javascript">
  // Setup an event listener to make an API call once auth is complete
    function onLinkedInLoad() {


        IN.Event.on(IN, "auth", getProfileData);
    }

    // Handle the successful return from the API call
    function onSuccess(data) {
        console.log(data);

    }

    // Handle an error response from the API call
    function onError(error) {
        console.log(error);
    }

    // Use the API call wrapper to request the member's basic profile data
    function getProfileData() {
    var fields = ['firstName', 'lastName', 'emailAddress'];

       IN.API.Profile("me").fields(fields).result(onSuccess).error(onError);
    }
</script>
和HTML:

<script type="in/Login"></script>

我不知道当前版本是否可以返回电子邮件,或者电子邮件是用户设置,因此每个用户的设置都不同。

范围中缺少r\u emailaddress:

<script type="text/javascript" src="//platform.linkedin.com/in.js">
       api_key: 11111111111
       onLoad:  onLinkedInLoad
       authorize: true
       scope: r_basicprofile r_emailaddress
</script>

最后,在LinkedIn developer上检查你的应用程序设置,你授予r_emailaddress访问权限。

字段是否已更新-我以为是“lastName”等。
var fields = ['first-name', 'last-name', 'email-address'];