[英]iOS LinkedIn API error
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: 我正在尝试在我的项目中实现这个LinkedIn库 ,但是当我尝试呈现LinkedIn屏幕时,我似乎遇到了错误:
Authorization failed LinkedIn1: Error Domain=LIALinkedInERROR Code=1 "The operation couldn't be completed. (LIALinkedInERROR error 1.)"
授权失败LinkedIn1:错误域= LIALinkedInERROR代码= 1“操作无法完成。(LIALinkedInERROR错误1.)”
You can find the code that I am using here . 你可以在这里找到我正在使用的代码。
I also faced the same problem .My error was Error Domain=LIALinkedInERROR Code=2. 我也遇到了同样的问题。我的错误是Error Domain = LIALinkedInERROR Code = 2。 On 26th May , 2016 the Linkedin has again made some changes due to which extra '#!'
在2016年5月26日,Linkedin再次进行了一些更改,因为额外的'#!' are added to the state and as a result ,the state do not match in LIALinkedInAuthorizationViewController class.
被添加到状态,因此,LIALinkedInAuthorizationViewController类中的状态不匹配。 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 {
在此方法的else部分
- (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. `或apply包含字符串,以便完全匹配状态。
I know its kind of a weird solution but that did the trick for me. 我知道这种奇怪的解决方案,但这对我有用。 Hope it helps you as well.
希望它也能帮到你。 All the best
祝一切顺利
Since the 12th May Linkedin's API has changed. 自5月12日以来,Linkedin的API已发生变化。 From now on any apps requesting
r_contactinfo
must be approved by LinkedIn. 从现在开始,任何请求
r_contactinfo
应用r_contactinfo
必须得到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"
. 我正在使用这个库,只需将权限从
@"r_contactinfo"
更改为@"r_basicprofile", @"r_emailaddress"
。
Also remember to change your app permissions on developer.linkedin.com to match the above. 还要记得在developer.linkedin.com上更改您的应用权限以匹配上述内容。
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: 也在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=%@";
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
除此之外你还可以使用这个库还有LinkedinIOSHelper ,它很容易使用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.