如何获得linkedin连接? [英] How to get linkedin connections?

查看:108
本文介绍了如何获得linkedin连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,用户可以选择通过linkedin登录应用程序.登录后,我必须获得用户的连接.当我尝试与用户建立联系时,我得到的响应为

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
 }

这是我的代码

 -(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]);
}

推荐答案

如果您使用的是OAuth入门工具包,请尝试以下操作. . .

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

  1. 首先转到 https://www.linkedin.com/secure/developer编辑您的App范围,确保已检查r_network范围.

  1. first go to https://www.linkedin.com/secure/developer edit your App scope , make sure you have checked the r_network scope .

然后转到您项目的OAuthLoginView,然后转到-(void)requestTokenFromProvider方法.

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

在以下几行中编辑您的范围.

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"];

这篇关于如何获得linkedin连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆