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

Safari cannot open the page because too many redirects occurre on iPad #592

Open
hoangdv198 opened this issue Dec 27, 2024 · 10 comments
Open

Comments

@hoangdv198
Copy link

🐛 Bug Report

Device: iPad Gen 9 running iOS 17.3
When attempting to log in to Facebook on an iPad without the Facebook app installed, the login fails with the error message:

"Safari can't open the page because too many redirects occurred."

Screenshot-1226-153700

This issue does not occur on iPhones under the same conditions.

To Reproduce

  1. Use an iPad where the Facebook app is not installed.
  2. Implement Facebook login using react-native-fbsdk-next.
  3. Tap the Facebook login button in the app to open the Facebook login flow in a WebView.
  4. Observe the error message:
    "Safari can't open the page because too many redirects occurred."

Expected Behavior

The Facebook login flow should work correctly on an iPad, even if the Facebook app is not installed, just as it does on an iPhone.

Code Example

  const signInFacebook = async () => {
    try {
      loadingGlobalRef.setLoading(true);
      const result = await LoginManager.logInWithPermissions([
        'public_profile',
        'email',
      ]);

      if (result.isCancelled) {
        throw 'User cancelled the login process';
      }

      const token = await AccessToken.getCurrentAccessToken();
      const currentProfile = await Profile.getCurrentProfile();

      //
      loginSocialToBackEnd.run({
        socialType: 'FACEBOOK',
        deviceName: deviceId,
        socialToken: token.accessToken,
        userId: currentProfile.userID,
      });
    } catch (error) {
      console.error(error);
      loadingGlobalRef.setLoading(false);
    }
  };

Environment

System:
OS: macOS 14.5
CPU: (8) arm64 Apple M1
Memory: 106.38 MB / 16.00 GB
Shell:
version: "5.9"
Binaries:
Node:
version: 20.10.0
Yarn:
version: 1.22.22
npm:
version: 10.2.3
Watchman:
version: 2023.09.04.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.15.2
SDKs:
iOS SDK:
Platforms:
- DriverKit 23.5
- iOS 17.5
- macOS 14.5
- tvOS 17.5
- visionOS 1.2
- watchOS 10.5
Android SDK:
API Levels:
- "26"
- "28"
- "29"
- "30"
- "31"
- "32"
- "33"
- "33"
- "34"
Build Tools:
- 28.0.3
- 29.0.2
- 29.0.3
- 30.0.2
- 30.0.3
- 31.0.0
- 33.0.0
- 33.0.1
- 34.0.0
- 34.0.0
System Images:
- android-28 | Google APIs ARM 64 v8a
- android-32 | Google APIs ARM 64 v8a
- android-32 | Google Play ARM 64 v8a
- android-UpsideDownCake | Google APIs ARM 64 v8a
- android-UpsideDownCake | Google Play ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2023.2 AI-232.10227.8.2321.11479570
Xcode:
version: 15.4/15F31d
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.10
path: /usr/bin/javac
Ruby:
version: 2.7.5
path: /Users/hoangdang/.rvm/rubies/ruby-2.7.5/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.73.1
wanted: 0.73.1
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false

@hoangdv198 hoangdv198 changed the title Safari cannot open the page because too many redirects occurre Safari cannot open the page because too many redirects occurre on iPad Dec 27, 2024
@mikehardy
Copy link
Collaborator

Given this module is a very thin wrapper around the facebook-ios-sdk you may need to check upstream for this and/or log this there with a native reproduction - asking Xcode to generate an empty app then putting the minimum code in from https://developers.facebook.com/docs/ios/use-facebook-login along with a test app id should be enough to reproduce the problem

@hoangdv198
Copy link
Author

Given this module is a very thin wrapper around the facebook-ios-sdk you may need to check upstream for this and/or log this there with a native reproduction - asking Xcode to generate an empty app then putting the minimum code in from https://developers.facebook.com/docs/ios/use-facebook-login along with a test app id should be enough to reproduce the problem

I have tried building a native iOS app with the facebook-sdk-ios package, and I noticed that the issue only occurs with the older version and has been resolved in the latest version. I tested version 16.3.1 (the version currently used by react-native-fbsdk-next), and the issue persists. However, when I updated to the latest version 17.1.0, it worked fine and the issue no longer occurred.

@mikehardy
Copy link
Collaborator

@hoangdv198

Please explain how you see version 16.3.1 of facebook-ios-sdk. It isn't the one we request.

@vanditmehta
Copy link

I am getting same issue.

@Helen2hang
Copy link

Helen2hang commented Jan 28, 2025

I have the same issue even with the latest release version 13.4.1. Apple is rejecting my app because of it. Any work around?

@vanditmehta
Copy link

I have also got rejection due to this issue. Any work around? please.

@mikehardy
Copy link
Collaborator

I have tried building a native iOS app with the facebook-sdk-ios package, and I noticed that the issue only occurs with the older version and has been resolved in the latest version. I tested version 16.3.1 (the version currently used by react-native-fbsdk-next), and the issue persists. However, when I updated to the latest version 17.1.0, it worked fine and the issue no longer occurred.

There is a user report that with the latest version it does not happen.

There are a bunch of "me too" comments that do not include any information about what version they are reproducing on and the exact steps to reproduce.

Who should I believe? In the absence of proof, I'm going with the "works fine on current versions" statement.

Anyone still experiencing this problem, please state exact steps to reproduce from scratch with all versions specified

@Helen2hang
Copy link

Helen2hang commented Feb 3, 2025

Hi @mikehardy,
Here are the information that I can give you:

  • I updated to the latest version of react-native-fbsdk so version 13.4.1 and I still experience this error
  • Note: The problem does not occur when App Tracking is disabled (Maybe the reason why hoangdv198 said that the issue has been fixed). When it's Limited Login we do not see that error. Only when App tracking is enabled that we see this error.
  • bug occurs on iPad 10th generation (OS 17.2) simulator and iPad Air 5th generation (OS 18.2.1) Real device tested by Apple reviewers

Steps to reproduce

  • Create a button that uses LoginManager.loginWithPermissions function for Facebook Login
 LoginManager.logInWithPermissions([
  "public_profile",
  "email",
  "user_posts",
  "pages_manage_engagement",
  "read_insights",
  "pages_read_engagement",
  "pages_read_user_content",
  "pages_manage_metadata",
  "publish_video",
  "pages_manage_posts",
  "pages_show_list",
  "ads_management",
  "business_management",
]);
  • Enable App Tracking for your App in your App's your settings.
Image
  • Press on the Facebook button, and then "Continue", you will see the error Safari cannot open the page because too many redirects occured.
Image

@mikehardy
Copy link
Collaborator

🤔 hmmm @Helen2hang looks like it may happen even with limited login, and looks like an upstream issue:

https://github.com/search?q=repo%3Afacebook%2Ffacebook-ios-sdk+too+many+redirects&type=issues

facebook/facebook-ios-sdk#2544

Have you tried their demo app to see if it reproduces there (possibly with some tweaks...) - because if it is an upstream issue we won't have any power to change it here, and the best way to get it changed there is with a reproducible demo - https://github.com/facebook/facebook-ios-sdk/tree/main/samples/FacebookLoginSample (though...it looks like that sample is pretty old, not sure if it will be a great starting point for a reproduction but I hope it is)

@hoangdv198
Copy link
Author

hoangdv198 commented Feb 4, 2025

@hoangdv198

react-native-fbsdk-next/react-native-fbsdk-next.podspec

Line 4 in 4df764f

FBSDKVersion = "17.4"
Please explain how you see version 16.3.1 of facebook-ios-sdk. It isn't the one we request.

Sorry for the late reply. I'm using version 16.3.1 because it fixed the 'Limited Login' warning that still appears in the login modal on the latest version. 😅
#514

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

4 participants