iOS LinkedIn API error

时光总嘲笑我的痴心妄想 提交于 2019-12-19 04:14:21

问题


I am trying to implement this LinkedIn library in my project, but it seems that I get an error while I try to present the LinkedIn screen:

Authorization failed LinkedIn1: Error Domain=LIALinkedInERROR Code=1 "The operation couldn’t be completed. (LIALinkedInERROR error 1.)"

You can find the code that I am using here.


回答1:


May this information help you -

API Terms of Use

Transition Guide




回答2:


I also faced the same problem .My error was Error Domain=LIALinkedInERROR Code=2. On 26th May , 2016 the Linkedin has again made some changes due to which extra '#!' are added to the state and as a result ,the state do not match in LIALinkedInAuthorizationViewController class. So the solution is to remove those 2 characters either by replacing string or by checking contain string.

In the else part of this method - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {

change to `

      NSString *receivedState = [[self extractGetParameter:@"state" fromURLString: url] stringByReplacingOccurrencesOfString:@"#!" withString:@""];

` or apply contains string so that the state is matched completely.

I know its kind of a weird solution but that did the trick for me. Hope it helps you as well. All the best




回答3:


Since the 12th May Linkedin's API has changed. From now on any apps requesting r_contactinfo must be approved by LinkedIn. This link explains the changes.

I'm using this Library and just had to change the permissions from @"r_contactinfo" to @"r_basicprofile", @"r_emailaddress".

Also remember to change your app permissions on developer.linkedin.com to match the above.




回答4:


You should have to use:

code=https://www.linkedin.com/oauth/v2/authorization?

In place of:

code=https://www.linkedin.com//uas/oauth2/authorization?

Also in linkedin api:

LIALinkedInAuthorizationViewController.m
LIALinkedInHttpClient

Change:

NSString *accessTokenUrl = @"/uas/oauth2/accessToken?grant_type=authorization_code&code=%@&redirect_uri=%@&client_id=%@&client_secret=%@";

By:

NSString *accessTokenUrl = @"/oauth/v2/accessToken?grant_type=authorization_code&code=%@&redirect_uri=%@&client_id=%@&client_secret=%@";



回答5:


Jack's answer is absolutely true, Jack's Answer. In addition to this you can use this library also LinkedinIOSHelper , it is easy to use



来源:https://stackoverflow.com/questions/30232359/ios-linkedin-api-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!