IOSLinkedInAPI
IOSLinkedInAPI copied to clipboard
Authorization failed Error Domain=LIALinkedInERROR Code=2
After click "Sign in" on login page (the webview), I got this error, it effects all our app users. The example project in your repo doesn't work either.
for anyone else who got the same problem, i found it's Linkedin append an anchor to redirect_url. And - (NSString *)extractGetParameter: (NSString *) parameterName fromURLString:(NSString *)urlString
made mistake.
[fg214,57,30;2016-08-29 17:53:49:101[63184:500845] Authorization failed Error Domain=LIALinkedInERROR Code=2 "(null)"
[;(lldb) po url
https://www.xxx.com/linkedin/callback?code=AQQGRw4EY7qajQbZA6fuYUs1XOhJcGW41Fls-3y70ifqvWReeylRgeRaZrN-D1CnJl1fEEQikTqPSCXqzsAyb8K_Yl1GprxxxDBKs_1k6KWQN8pi3no&state=DCEEFWF45453sdffef424#!
(lldb) po self.application.state
DCEEFWF45453sdffef424
(lldb) po receivedState
DCEEFWF45453sdffef424#!
fix is quite straight forward as well
- (NSString *)extractGetParameter: (NSString *) parameterName fromURLString:(NSString *)urlString {
NSMutableDictionary *mdQueryStrings = [[NSMutableDictionary alloc] init];
urlString = [[urlString componentsSeparatedByString:@"#"] objectAtIndex:0];
urlString = [[urlString componentsSeparatedByString:@"?"] objectAtIndex:1];
for (NSString *qs in [urlString componentsSeparatedByString:@"&"]) {
[mdQueryStrings setValue:[[[[qs componentsSeparatedByString:@"="] objectAtIndex:1]
stringByReplacingOccurrencesOfString:@"+" withString:@" "]
stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]
forKey:[[qs componentsSeparatedByString:@"="] objectAtIndex:0]];
}
return [mdQueryStrings objectForKey:parameterName];
}
@Arthraim solution works for me
I am using latest sdk . It is using LinkedIn app for authorization process. I m getting the same error LIALinkedInERROR Code=2 only at iOS 10 phones. Its working fine for iOS 9 and even 11 too.
Your above method is not available for alter. Please suggest any other possible solution to fix it.