IOS expo-facebook login doesn't close modal when redirect so it does't finish the authentication properly

Hello,

I was trying to make the facebook authentication on a bare react native app. So i implemented the method as the documentation said.

Facebook.logInWithReadPermissionsAsync

Everything works fine at the beginning my app open my facebook app and prompt the screen asking you if you want to make login with facebook but then when facebook redirects back the modal that was previously open never get closed so the authentication never completes.

Then the problem was solved adding the next lines to my appDelegate.m

#import <FBSDKApplicationDelegate.h>
.
.
.
- (BOOL)application:(UIApplication *)application
            openURL:(NSURL *)url
            options:(nonnull NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options
{
  [[FBSDKApplicationDelegate sharedInstance] application:application
                                                 openURL:url
                                                 options:options];
  return YES;
}

But the i need to comment some lines because xcode shows that method was duplicated.

The previous method was like this

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *, id> *) options {
  return [self.authorizationFlowManagerDelegate resumeExternalUserAgentFlowWithURL:url];
 }

If some one knows what does the previous lines because indeed the new method solve facebook login problem but I don’t know id the lines I commented were important.

Thanks in advance for your help.

I have same issue with SDK41. I wonder if you found a solution? Thank you

Any updates on this?

I solved this by merging my 2 duplicate methods.

In your case, try to replace the existing method with this:

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *, id> *) options {
   BOOL handledFB = [[FBSDKApplicationDelegate sharedInstance] application:application
                    openURL:url
                    options:options];

   BOOL handledFlow = [self.authorizationFlowManagerDelegate resumeExternalUserAgentFlowWithURL:url]
  
   return handledFlow || handledFB;
 }