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

Facebook Login getting Error "Safari can't open the page because too many redirects occurred" on iPad #2546

Open
5 tasks done
kevin-zqw opened this issue Feb 12, 2025 · 1 comment

Comments

@kevin-zqw
Copy link

Checklist before submitting a bug report

Xcode version

16.2

Facebook iOS SDK version

13.2.0 & 17.1.0

Dependency Manager

Prebuilt Binaries

SDK Framework

Login

Goals

Players can sign in to my app with their Facebook accounts.

Expected results

Login succeed

Actual results

Over the past two months, we have been receiving more than 10 daily reports from players who are unable to log into our app via Facebook. Most of these issues occur on iPad devices, spanning iOS versions from 12 to 18, and the total number of affected players has now exceeded 150. I was able to reproduce this issue myself on an iPad mini 2 running iOS 12.5.5. When a player attempts to log in, the Facebook SDK opens Safari to load login.facebook.com, but it gets stuck in an infinite loop of redirections. Eventually, Safari displays the error: "Safari can’t open the page because too many redirects occurred."

I tried switching to a different Facebook App ID and upgraded the SDK to version v17.1.0. I also wrote a minimal example code for Facebook login, but the issue still persists on the same iPad mini 2 device. This suggests that the problem is unrelated to the Facebook App ID or the version of the Facebook iOS SDK. My suspicion is that the issue is specific to certain iPad devices, possibly due to the login.facebook.com webpage entering an infinite loop of redirections based on the user agent. When the number of redirections exceeds the limit, Safari stops loading the Facebook webpage altogether.

Image

Steps to reproduce

It seems like the issue is easily reproducible across multiple iPad devices. If you test on several iPads (especially older models or those running specific iOS versions), you might consistently encounter the same problem where the Facebook login process results in an infinite redirection loop and ultimately fails with the "too many redirects" error in Safari.

Code samples & details

FBSDKLoginManager *loginMgr = [[FBSDKLoginManager alloc] init];
    [loginMgr logOut];
    
    [loginMgr logInWithPermissions: permissions fromViewController:nil handler:^(FBSDKLoginManagerLoginResult * _Nullable result, NSError * _Nullable error) {
        if (error) { //login facebook failed
            
        } else if (result.isCancelled) {// Handle cancellations
            
        } else { //login facebook success
            
        }
    }];
@tadaspetrikas
Copy link

tadaspetrikas commented Feb 19, 2025

Some more details:

SDK: 18.0.0

Going through another api, login works on iPad, but just for .limited access:

 let configuration = LoginConfiguration(
                        permissions: ["email"]
                        tracking: .limited,
                        nonce: UUID().uuidString
                    )
                    
LoginManager().logIn(viewController: self, configuration: configuration) { result in
    switch result {
    case .success:
        if let authToken = AuthenticationToken.current?.tokenString {
            complete(.success)
        } else {
            complete(.failure)
        }
        
    case .cancelled:
        complete(.dismissed)
        return
        
    case .failed:
        complete(.failure)
        return
    }
} 

If we go with configuration like this, where tracking is .enabled:

 let configuration = LoginConfiguration(
                        permissions: ["email"]
                        tracking: .enabled,
                        nonce: UUID().uuidString
                    )

Also getting "to many redirects issue".

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

No branches or pull requests

2 participants