2

我正在开发一个本地移动应用程序,我需要传递用户的访问令牌并获取用户详细信息以进行基于移动的操作。我能够在 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 中获得相同的任何帮助。

4

1 回答 1

0

查看LinkedIn 的关于用 JSAPI 令牌交换 OAuth 令牌的文档。

于 2014-10-23T10:44:45.350 回答