【问题标题】:How to generate access token for LinkedIn?如何为 LinkedIn 生成访问令牌?
【发布时间】:2016-03-22 16:36:14
【问题描述】:

我只是想从我的 iOS 应用程序中“与linkedIn分享”。”

如何在链接的 In 上共享之前生成访问令牌,如何 生成它?

这是我在链接的 In 中发布的代码。但它不起作用,因为我没有访问令牌。

// For positing on linked In

    [[LISDKAPIHelper sharedInstance] apiRequest:@"https://api.linkedin.com/v1/people/~/shares?format=json" method:@"POST" body:[bodyTxtView.text dataUsingEncoding:NSUTF8StringEncoding]
                success:^(LISDKAPIResponse *response)
                 {
                     NSLog(@"success called %@", response.data);
                }
              error:^(LISDKAPIError *apiError) {
                   NSLog(@"error called %@", apiError.description);

                    dispatch_sync(dispatch_get_main_queue(), ^{
                        LISDKAPIResponse *response = [apiError errorResponse];
                                                  NSString *errorText;
                              if (response)
                              {
                                    errorText = response.data;
                               }
                               else
                               {
                                   errorText = apiError.description;
                                }
                        NSLog(@"error called %@", errorText);
                 });
          }];

【问题讨论】:

标签: ios objective-c linkedin linkedin-api


【解决方案1】:

你可以使用这个类可能对你有帮助!! apikey = @"75pxdmwh5ghbil"; 密钥 = @"j3iYOXotT37VhPbM";

consumer = [[OAConsumer alloc] initWithKey:apikey
                                    secret:secretkey
                                     realm:@"http://api.linkedin.com/"];

requestTokenURLString = @"https://api.linkedin.com/uas/oauth/requestToken";
accessTokenURLString = @"https://api.linkedin.com/uas/oauth/accessToken";
userLoginURLString = @"https://www.linkedin.com/uas/oauth/authorize";    
linkedInCallbackURL = @"hdlinked://linkedin/oauth";

requestTokenURL = [[NSURL URLWithString:requestTokenURLString] retain];
accessTokenURL = [[NSURL URLWithString:accessTokenURLString] retain];
userLoginURL = [[NSURL URLWithString:userLoginURLString] retain];

【讨论】:

    【解决方案2】:

    https://developer.linkedin.com/downloads下载的SDK(在示例应用程序内)中给出了示例代码

    【讨论】:

      猜你喜欢
      • 2014-03-07
      • 2020-05-06
      • 2015-09-25
      • 2014-11-01
      • 2018-03-10
      • 2016-09-04
      • 1970-01-01
      • 2020-02-29
      • 1970-01-01
      相关资源
      最近更新 更多