Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authorization failed Error Domain=LIALinkedInERROR Code=2 #78

Open
Arthraim opened this issue Aug 29, 2016 · 4 comments
Open

Authorization failed Error Domain=LIALinkedInERROR Code=2 #78

Arthraim opened this issue Aug 29, 2016 · 4 comments

Comments

@Arthraim
Copy link

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.

@Arthraim
Copy link
Author

Arthraim commented Aug 29, 2016

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#!

@Arthraim
Copy link
Author

Arthraim commented Aug 29, 2016

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];
}

@niwantha
Copy link

@Arthraim solution works for me

@wal-arsalan
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants