iOS LinkedIn API 错误
iOS LinkedIn API error
我正在尝试在我的项目中实施 this LinkedIn library,但在尝试显示 LinkedIn 屏幕时似乎出现错误:
Authorization failed LinkedIn1: Error Domain=LIALinkedInERROR Code=1
"The operation couldn’t be completed. (LIALinkedInERROR error 1.)"
您可以找到我正在使用的代码 here。
希望这些信息对您有所帮助 -
自 5 月 12 日起,Linkedin 的 API 发生了变化。从现在开始,任何请求 r_contactinfo
的应用都必须得到 LinkedIn 的批准。 This link 解释变化。
我正在使用这个库,只需将权限从 @"r_contactinfo"
更改为 @"r_basicprofile", @"r_emailaddress"
。
另请记住更改您在 developer.linkedin.com 上的应用权限以匹配上述内容。
杰克的回答绝对正确,. In addition to this you can use this library also LinkedinIOSHelper,很容易上手
我也遇到了同样的问题。我的错误是 Error Domain=LIALinkedInERROR Code=2。 2016 年 5 月 26 日,Linkedin 再次进行了一些更改,因为额外的“#!”被添加到状态,因此,状态在 LIALinkedInAuthorizationViewController class 中不匹配。所以解决方案是通过替换字符串或检查包含字符串来删除这 2 个字符。
在这个方法的else部分- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
改为`
NSString *receivedState = [[self extractGetParameter:@"state" fromURLString: url] stringByReplacingOccurrencesOfString:@"#!" withString:@""];
` 或 apply 包含字符串,以便完全匹配状态。
我知道这是一种奇怪的解决方案,但它对我有用。希望它也能帮助你。
祝一切顺利
你应该使用:
code=https://www.linkedin.com/oauth/v2/authorization?
代替:
code=https://www.linkedin.com//uas/oauth2/authorization?
也在 linkedin api:
LIALinkedInAuthorizationViewController.m
LIALinkedInHttpClient
变化:
NSString *accessTokenUrl = @"/uas/oauth2/accessToken?grant_type=authorization_code&code=%@&redirect_uri=%@&client_id=%@&client_secret=%@";
作者:
NSString *accessTokenUrl = @"/oauth/v2/accessToken?grant_type=authorization_code&code=%@&redirect_uri=%@&client_id=%@&client_secret=%@";
我正在尝试在我的项目中实施 this LinkedIn library,但在尝试显示 LinkedIn 屏幕时似乎出现错误:
Authorization failed LinkedIn1: Error Domain=LIALinkedInERROR Code=1 "The operation couldn’t be completed. (LIALinkedInERROR error 1.)"
您可以找到我正在使用的代码 here。
希望这些信息对您有所帮助 -
自 5 月 12 日起,Linkedin 的 API 发生了变化。从现在开始,任何请求 r_contactinfo
的应用都必须得到 LinkedIn 的批准。 This link 解释变化。
我正在使用这个库,只需将权限从 @"r_contactinfo"
更改为 @"r_basicprofile", @"r_emailaddress"
。
另请记住更改您在 developer.linkedin.com 上的应用权限以匹配上述内容。
杰克的回答绝对正确,
我也遇到了同样的问题。我的错误是 Error Domain=LIALinkedInERROR Code=2。 2016 年 5 月 26 日,Linkedin 再次进行了一些更改,因为额外的“#!”被添加到状态,因此,状态在 LIALinkedInAuthorizationViewController class 中不匹配。所以解决方案是通过替换字符串或检查包含字符串来删除这 2 个字符。
在这个方法的else部分- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
改为`
NSString *receivedState = [[self extractGetParameter:@"state" fromURLString: url] stringByReplacingOccurrencesOfString:@"#!" withString:@""];
` 或 apply 包含字符串,以便完全匹配状态。
我知道这是一种奇怪的解决方案,但它对我有用。希望它也能帮助你。 祝一切顺利
你应该使用:
code=https://www.linkedin.com/oauth/v2/authorization?
代替:
code=https://www.linkedin.com//uas/oauth2/authorization?
也在 linkedin api:
LIALinkedInAuthorizationViewController.m
LIALinkedInHttpClient
变化:
NSString *accessTokenUrl = @"/uas/oauth2/accessToken?grant_type=authorization_code&code=%@&redirect_uri=%@&client_id=%@&client_secret=%@";
作者:
NSString *accessTokenUrl = @"/oauth/v2/accessToken?grant_type=authorization_code&code=%@&redirect_uri=%@&client_id=%@&client_secret=%@";