2014-05-19 150 views
2

我正在开发一个原生的移动应用程序,我需要的是传递用户的访问令牌并获取用于执行基于移动的操作的用户详细信息。我能够在Facebook中实现同样的功能。但是我如何通过LinkedIn JavaScript API获取用户的访问令牌。如何使用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同样将是非常赞赏。

回答

相关问题