64177

How to get linkedin connections?

Question:

In my app user has a option to login to app through linkedin.after login i have to get user's connections. when i try to get users connections i am getting response as

{ "errorCode": 0, "message": "Access to connections denied", "requestId": "60A0DS1MZE", "status": 403, "timestamp": 1386682428799 }

Here is my code

-(void)GetConnectionsCall { NSURL *url = [NSURL URLWithString:@"http://api.linkedin.com/v1/people/~/connections"]; OAMutableURLRequest *request = [[OAMutableURLRequest alloc] initWithURL:url consumer:_oAuthLoginView.consumer token:_oAuthLoginView.accessToken callback:nil signatureProvider:nil]; [request setValue:@"json" forHTTPHeaderField:@"x-li-format"]; OADataFetcher *fetcher = [[OADataFetcher alloc] init]; [fetcher fetchDataWithRequest:request delegate:self didFinishSelector:@selector(connectionsApiCallResult:didFinish:) didFailSelector:@selector(connectionsApiCallResult:didFail:)]; } - (void)connectionsApiCallResult:(OAServiceTicket *)ticket didFinish:(NSData *)data { NSString *responseBody = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; NSLog(@"connectionsApiCallResult====%@",responseBody); } - (void)connectionsApiCallResult:(OAServiceTicket *)ticket didFail:(NSError *)error { NSLog(@"%@",[error description]); }

Answer1:

if you are using OAuth Starter Kit try this . . . .

<ol><li>

first go to <a href="https://www.linkedin.com/secure/developer" rel="nofollow">https://www.linkedin.com/secure/developer</a> edit your App scope , make sure you have checked the r_network scope .

</li> <li>

then go to OAuthLoginView of you project , then go to -(void) requestTokenFromProvider method .

</li> </ol>

edit you scope in below lines .

OARequestParameter *nameParam = [[OARequestParameter alloc] initWithName:@"scope" value:@"r_fullprofile+rw_nus+r_network"]; OARequestParameter * scopeParameter=[OARequestParameter requestParameter:@"scope" value:@"r_fullprofile rw_nus r_network"];

Answer2:

You need to ask for permissions.. When this is not done you are not allowed to query this information.

Everything documented here: <a href="http://developer.linkedin.com/documents/connections-api" rel="nofollow">http://developer.linkedin.com/documents/connections-api</a>

Recommend

  • Error: Like/Unlike and Comment using LinkedIn REST Api for iOS
  • Facebook SDK Android: OnSuccess called but OnCancel not called
  • Azure Active Directory Graph API - access token for signed in user
  • How to represent a form-data request using Akka HTTP?
  • Facebook token Android SDK refresh criteria
  • How to get new token after calling reconnect api of Intuit? [duplicate]
  • Multiple emails selected messageMetadata.accessToken
  • Sound Cloud returning 401 error
  • I want to find populate OR search, mongoose
  • How to authorize SignalR Core Hub method with JWT
  • React Native - async/await does not work
  • Batch requests in Node.js
  • Does this code create a circular memory reference in Ruby?
  • Is it possible to revoke AWS Cognito IdToken?
  • POSTMAN - Schema validation is passed even for bad response data
  • No permission to access invitable friends
  • Not able to get access token for google+ through Oauth 2.0 in iPhone application
  • Hiding contentful Space id and access token, client side javascript file
  • how to set environment variables on google appengine?
  • WooCommerce REST Client API - Programmatically get consumer key and secret
  • how to perform file upload using Volley in android?
  • Firebase Authentication Javascript: setCookie for pending Credential for redirect
  • Task processing status with a message queue
  • My Produce Consumer Hangs
  • ILMerge: Rename internalized assemblies' namespaces?
  • Migration tool for ANTLR grammar
  • IDX10503: Signature validation failed
  • oauth2client.client.HttpAccessTokenRefreshError: invalid_grant: Invalid JWT
  • Syntax error near unexpected token 'elif'
  • Creating a C++ function that calls other Lua function
  • pythonanywhere - How do I use websockets to transmit messages as per the web2py messaging example?
  • read values from form post in jquery or javascript
  • Defined variables not working in javascript files when I use getScript
  • Can't remove headers after they are sent
  • How to synchronize jQuery dialog box to act like alert() of Javascript
  • How to remove a SwiftyJSON element?
  • Row Count Is Returning the incorrect number using RaptureXML
  • Obtain ObjectIdHex value from mgo query
  • NSLayoutConstraint that would pin a view to the bottom edge of a superview
  • Bitwise OR returns boolean when one of operands is nil