Skip to content

Commit

Permalink
Merge pull request facebook#382 from FunkeeMonk/inline_fallback
Browse files Browse the repository at this point in the history
Fallback to inline authentication dialog if SSO login fails.
  • Loading branch information
lshepard committed Sep 10, 2011
2 parents c83bcaa + 74ae952 commit cb4b1c3
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions src/Facebook.m
Expand Up @@ -312,18 +312,18 @@ - (BOOL)handleOpenURL:(NSURL *)url {
if (!accessToken) {
NSString *errorReason = [params valueForKey:@"error"];

// If the error response indicates that we should try again using Safari, open
// the authorization dialog in Safari.
if (errorReason && [errorReason isEqualToString:@"service_disabled_use_browser"]) {
[self authorizeWithFBAppAuth:NO safariAuth:YES];
return YES;
}

// If the error response indicates that we should try the authorization flow
// in an inline dialog, do that.
if (errorReason && [errorReason isEqualToString:@"service_disabled"]) {
[self authorizeWithFBAppAuth:NO safariAuth:NO];
return YES;
if (errorReason) {
// If the error response indicates that we should try again using Safari, open
// the authorization dialog in Safari.
if ([errorReason isEqualToString:@"service_disabled_use_browser"]) {
[self authorizeWithFBAppAuth:NO safariAuth:YES];
}
// Any other error response indicates that we should try the authorization flow
// in an inline dialog
else {
[self authorizeWithFBAppAuth:NO safariAuth:NO];
}
return YES;
}

// The facebook app may return an error_code parameter in case it
Expand All @@ -346,7 +346,6 @@ - (BOOL)handleOpenURL:(NSURL *)url {
expirationDate = [NSDate dateWithTimeIntervalSinceNow:expVal];
}
}

[self fbDialogLogin:accessToken expirationDate:expirationDate];
return YES;
}
Expand Down

0 comments on commit cb4b1c3

Please sign in to comment.