jump to navigation

LinkedIn API and Twitter API access using GOOGLE Data API June 9, 2010

Posted by Ameya in iPhone, iPhone App Devlopment.
4 comments

LinkedIn API access using Google Data Api

Was facing problem linkedin API access using a suitable oauth client framework for iPhone.

The problem was there was no proper solution for this.

I had already come accross Google data API and their touch sample code available at http://code.google.com/p/gdata-objectivec-client/. which I was tring to access gmail for mails, but seems they have not opened that yet, although they provide access to Contact api.

Struggling to find an api access to linked in from iPhone stumbled upon this thread http://developer.linkedin.com/thread/1447 which redirected me to this http://developer.linkedin.com/thread/1169. Here you will find a lot of comments and sample application created by “Scott” and if u mail him you will get the source.

But still I was not satisfied as I wanted to use  MPOAuthMobile for iPhone for a unified access to twitter and linkedin.

So here is the simple and elegant solution using  Google Data API , (you can trust google so I prefer it as a solution).

Simply download the the sample from http://code.google.com/p/gdata-objectivec-client/

Replace twitter

keys as below

NSString *myConsumerKey = @”XXXXXXXXX”; //NEED TO ENTER YOUR CONSUMER
KEY FROM LINKEDIN API

NSString *myConsumerSecret = @”XXXXXX”; //NEED TO ENTER YOUR CONSUMER
SECRET FROM LINKEDIN API

I accept that you have a consumer secrete and key. Else get it by registering your application at https://www.linkedin.com/secure/developer

and replace the URL set as below

NSURL *requestURL = [NSURL URLWithString:@"
https://api.linkedin.com/uas/oauth/requestToken"];
NSURL *authorizeURL = [NSURL URLWithString:@"
https://api.linkedin.com/uas/oauth/authorize"];
NSURL *accessURL = [NSURL URLWithString:@"
https://api.linkedin.com/uas/oauth/accessToken"];
NSString *scope = nil;

do not forget to replace this with your reverse domain name as

static NSString *const kAppServiceName = @”com.YOURDOMAIN.OAuthSampleTouch”;
static NSString *const kShouldSaveInKeychainKey = @”shouldSaveInKeychain”;

Run your application, click twiter tab and singin.

You should get a web view where you can login and the application pops back to return the oauth token.

This is where I got the solution

http://groups.google.com/group/gdata-objectivec-client/browse_thread/thread/d876c078b677334/5981e36d77c2151f?lnk=gst&q=Can+we+use+OAuth+Sample+provided+in+google+data+api+to+work+with+LinkedIn+Api#5981e36d77c2151f

Twitter API access using Google Data API

The application provided google should simply work simply you have take care of the following points.

Create your application at https://twitter.com/apps

  • Application Type: Browser not client ( if is a client application
    then will prompt for a pin which is used in the application to
    authenticate.).
  • Website: provide some web site.
  • Use Twitter for login: check mark Yes, use Twitter for login.
  • Callback URL:    http://www.google.com/OAuthCallback

Follow

Get every new post delivered to your Inbox.