Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

working with linkedin api

$
0
0

now i had used the api if linkedin and i had get the accessTokenKey but this accessTokenKey doesn't match with accessTokenKey that in the my api that used for my website

url = "xxxxxxxxxxxxxxxxxxxxxxxxx";
client = Ti.Network.createHTTPClient({
    onload : function(e) {
        Ti.API.info("Received text: " + this.responseText);
        var parse = JSON.parse(this.responseText);
        //alert(parse);
    },
    onerror : function(e) {
        Ti.API.debug(e.error);
        alert('error');
    },
    timeout : 10000
});
LinkedAcccess = null;
linkedId = null;
var linkedin = require('linkedin').Linkedin({
    consumerKey : 'xxxxxxxxxxxxxxxx',
    consumerSecret : 'xxxxxxxxxxxxxxxx',
    accessTokenKey : Ti.App.Properties.getString('linkedinAccessTokenKey', ''),
    accessTokenSecret : Ti.App.Properties.getString('linkedinAccessTokenSecret', '')
});
function linkedinAuthorize(event) {
    linkedin.addEventListener('login', function(e) {
        if (e.success) {
            LinkedAcccess = e.accessTokenKey;
            //alert(LinkedAcccess);
            Ti.App.Properties.setString('linkedinAccessTokenKey', e.accessTokenKey);
            Ti.App.Properties.setString('linkedinAccessTokenSecret', e.accessTokenSecret);
 
            linkedin.request('v1/people/~:(first-name,last-name,headline,picture-url,id)', {
                format : 'json'
            }, {}, 'GET', function(e) {
                if (e.success) {
                    var json = JSON.parse(e.result.text);
                    linkedId = json.id;
                    //alert(linkedId);
                    //requestData();
                } else {
                    // error proc...
                }
            });
        } else {
            alert('Error' + JSON.stringify(e));
            // error proc…
        }
    });
 
    linkedin.authorize();
};
 
if (linkedin.authorized) {
    linkedinAuthorize();
} else {
 
}
function requestData() {
    if (LinkedAcccess && linkedId !== null) {
        //alert(LinkedAcccess);
        client.open("POST", url);
        client.send({
            linkedin_id : linkedId,//'LPl1K5j8-N',
            linkedin_access_token : LinkedAcccess//'AQV3At55BtHcgw0iuEA7LTCCINZrsoyIzj_lT3nUcfs71ZlxcV7t-v8RDc8_f5oq8K-oNW_QNHI_QIw2LMer8YxiJmETncpu2RTX-fTnt44PtyQezl6NZ4g7HW-PIQyi5h3qxNvynvWrn_nE8q0uNYWWeUwDMTQYxurVH0NU0PJp3z89cFI'
        });
    }
}
AQV3At55BtHcgw0iuEA7LTCCINZrsoyIzj_lT3nUcfs71ZlxcV7t-v8RDc8_f5oq8K-oNW_QNHI_QIw2LMer8YxiJmETncpu2RTX-fTnt44PtyQezl6NZ4g7HW-PIQyi5h3qxNvynvWrn_nE8q0uNYWWeUwDMTQYxurVH0NU0PJp3z89cF
this is in the my api and this what i had get from my app
a48f5fde-d5c8-4de6-8cd1-c468a83321fa

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>