2015-12-16 99 views
1

我简单的想从我的iOS应用程序做“与LinkedIn共享”。”如何为LinkedIn生成访问令牌?

如何分享关于联在之前生成访问托克,如何 产生的呢?

这里是我的在联在发布代码,但它不工作,因为我没有访问令牌。

// 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); 
       }); 
      }]; 
+1

访问http://stackoverflow.com/questions/21676731/generating-linkedin-access-token下载SDK(示例应用程序内)给出 –

回答

-1

你可以使用这个类可以帮助你! apikey = @“75pxdmwh5ghbi L“; secretkey = @“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];