Skip to content

Instantly share code, notes, and snippets.

@aaronksaunders
Created November 8, 2011 16:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save aaronksaunders/1348356 to your computer and use it in GitHub Desktop.
Save aaronksaunders/1348356 to your computer and use it in GitHub Desktop.
LinkenIn IOS Javascript Module for Use with Appcelerator
/*
This is a minified javascript module because I have not had a chance to refactor and
clean up the horrible hacks I have done to make this work, and I don't want to expose
the code and then spend alot of time responding to issues and/or questions.
This code is released AS IS and I will clean it up, document it better and eventually
re-release it as a module or open source
*/
Ti.include('linkedin_module-min.js');
//
// MUST INITIALIZE WITH KEYS
// GET KEYS AT https://developer.linkedin.com/apis
//
linkedInModule.init('SECRET_KEY', 'API_KEY');
// THESE CALLS WRAP COMMON FUNCTIONS
linkedInModule.getUser(function(_d) {
Ti.API.info(_d);
});
linkedInModule.getShare(function(_d) {
Ti.API.info(_d);
});
linkedInModule.getNetworkShares(function(_d) {
Ti.API.info(_d);
});
linkedInModule.getMyShares(function(_d) {
Ti.API.info(_d);
});
linkedInModule.getConnections(function(_d) {
Ti.API.info(_d);
});
// THIS IS A GENERIC CALL TO PASS THE STANDARD REST API URLS
var _url = "people/~/suggestions/to-follow/companies";
linkedInModule.API(_url, null, function(_d) {
Ti.API.info(_d);
});
// HERE IS AN EXAMPLE USING THAT ENDPOINT TO POST A MESSAGE
var post_params = {
"comment" : "Testing LinkedIn Appcelerator Module #appcelerator",
"content" : {
"title" : "LinkedIn Appcelerator Module coming soon from Clearly Innovative Inc",
"submitted_url" : "http://www.clearlyinnovative.com",
"submitted_image_url" : "http://www.clearlyinnovative.com/logo.png",
"description" : "Javascript wrapper for easily integrating LinkedIn into mobile app"
},
"visibility" : {
"code" : "anyone"
}
}
linkedInModule.postMessage(post_params, function(_d) {
Ti.API.info(_d);
});
@cgetner-zz
Copy link

Can't seem to get this to work. After substituting my LinkedIn keys I get "�Script Error = 'undefined' is not an object (evaluating 'g.accessToken') at linkedin_module-min.js (line 143)."

@jitu86hbti
Copy link

this is not working i am also getting this error "Script Error = 'undefined' is not an object (evaluating 'g.accessToken') at linkedin_module-min.js (line 143)."

@jayeshIT
Copy link

i just take new project for Linked in and follow as above i also add one Linked in button and on it's click i run below function

linkedInModule.getUser(function(_d) {
Ti.API.info(_d);
});
that pop -up Linked in authentication window
i add cancel button on that window
so when i first time click on Linked in button and then suddenly click cancel button and again i click on Linked in button it shows error like below
"Script Error = 'undefined' is not an object (evaluating 'g.accessToken') at linkedin_module-min.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment