首页 文章

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

提问于
浏览
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获得相同的帮助将非常感谢 .

1 回答

相关问题