如何在Facebook中使用LinkedIn Javascript API获取用户访问令牌?

时间:2014-05-19 07:18:41

标签: linkedin linkedin-jsapi

我正在开发本机移动应用程序,我需要的是传递用户的访问令牌并获取用于执行基于移动的操作的用户详细信息。我能够在Facebook上实现同样的目标。但是如何通过LinkedIn JavaScript API获取用户的访问令牌。

Facebook API方式:

function statusChangeCallback(response) {
    // The response object is returned with a status field that lets the
    // app know the current login status of the person.
    // Full docs on the response object can be found in the documentation
    // for FB.getLoginStatus().
    if (response.status === 'connected') {
      // Logged into your app and Facebook.
    console.log(response);    ===> GOT USER ACCESS TOKEN FROM THIS RESPONSE  
    testAPI();
    } else if (response.status === 'not_authorized') {
      // The person is logged into Facebook, but not your app.
      document.getElementById('status').innerHTML = 'Please log ' +
        'into this app.';
    } else {
      // The person is not logged into Facebook, so we're not sure if
      // they are logged into this app or not.
      document.getElementById('status').innerHTML = 'Please log ' +
        'into Facebook.';
    }
  }

任何帮助在LinkedIn获得相同的帮助将非常感谢。

1 个答案:

答案 0 :(得分:0)

查看有关OAuth令牌交换JSAPI令牌的LinkedIn's Documentation