2014-05-19 190 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同樣將是非常讚賞。

回答

相關問題