jump to navigation

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

Posted by Ameya in iPhone, iPhone App Devlopment.
trackback

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

Advertisement

Comments»

1. Victor Alexander - July 2, 2010

Nice post! How would you do this with formspring.me though? I’m trying to recreate your linkedin steps but no luck :(

I’m also confused by the domain part. Can you explain it’s purpose, thanks!

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

2. Aaron Berk - September 8, 2010

When I sign in with Twitter, this works great, but when I used the LinkedIn code, I get a crash after the view pops. Has anyone seen this behavior?

Aaron Berk - September 8, 2010

I was able to find the crash. I needed to provide a valid “doAnAuthenticatedAPIFetch” api call for LinkedIn.

3. 2010 in review « iPhone App Dev Help - January 3, 2011

[...] LinkedIn API and Twitter API access using GOOGLE Data API June 2010 3 comments LikeBe the first to like this post. [...]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.