[英]Linkedin API 401 [unauthorized]. (iOS with OAuthStarterKit) Error
[英]iOS LinkedIn API error
我正在嘗試在我的項目中實現這個LinkedIn庫 ,但是當我嘗試呈現LinkedIn屏幕時,我似乎遇到了錯誤:
授權失敗LinkedIn1:錯誤域= LIALinkedInERROR代碼= 1“操作無法完成。(LIALinkedInERROR錯誤1.)”
你可以在這里找到我正在使用的代碼。
我也遇到了同樣的問題。我的錯誤是Error Domain = LIALinkedInERROR Code = 2。 在2016年5月26日,Linkedin再次進行了一些更改,因為額外的'#!' 被添加到狀態,因此,LIALinkedInAuthorizationViewController類中的狀態不匹配。 因此解決方案是通過替換字符串或通過檢查包含字符串來刪除這兩個字符。
在此方法的else部分- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
改為`
NSString *receivedState = [[self extractGetParameter:@"state" fromURLString: url] stringByReplacingOccurrencesOfString:@"#!" withString:@""];
`或apply包含字符串,以便完全匹配狀態。
我知道這種奇怪的解決方案,但這對我有用。 希望它也能幫到你。 祝一切順利
自5月12日以來,Linkedin的API已發生變化。 從現在開始,任何請求r_contactinfo
應用r_contactinfo
必須得到LinkedIn的批准。 此鏈接說明了這些更改。
我正在使用這個庫,只需將權限從@"r_contactinfo"
更改為@"r_basicprofile", @"r_emailaddress"
。
還要記得在developer.linkedin.com上更改您的應用權限以匹配上述內容。
你應該使用:
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=%@";
傑克的答案絕對是真的, 傑克的回答 。 除此之外你還可以使用這個庫還有LinkedinIOSHelper ,它很容易使用
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.