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 Not Working On The First Login #2439

Open
5 tasks done
aemreb opened this issue Jun 11, 2024 · 3 comments
Open
5 tasks done

Facebook Login Not Working On The First Login #2439

aemreb opened this issue Jun 11, 2024 · 3 comments

Comments

@aemreb
Copy link

aemreb commented Jun 11, 2024

Checklist before submitting a bug report

Xcode version

15.4

Facebook iOS SDK version

17.0.1

Dependency Manager

SPM

SDK Framework

Core

Goals

I want the Facebook app to redirect back to my app after login process is initialized while logged out on the Facebook app.

Expected results

I want the Facebook app to redirect back to my app.

Actual results

Facebook app stays in place, directs me to the home page.

Steps to reproduce

-Log out of Facebook on web and the mobile app
-Log in using the Facebook Login button placed inside the app
-See that the redirect mechanism back to the main app is broken, but it works fine if the user is already logged in on the FB app

Code samples & details

// INSERT YOUR CODE HERE
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        _ = ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
        return true
    }


    func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
        guard url.scheme != nil else { return false }
        if url.scheme == "fbxxxxxx" { //Facebook id
            return ApplicationDelegate.shared.application(app, open: url, options: options)
        }

        if url.host == "authorize" {
            Adjust.appWillOpen(url)
            return ApplicationDelegate.shared.application(app, open: url, options: options)
        }
        return true
    }



// ---------

        let facebookLoginButton = FBLoginButton()
        facebookLoginButton.delegate = self
        facebookLoginButton.permissions = ["public_profile", "email"]
        facebookLoginButton.sendActions(for: .touchUpInside)
        facebookSignInCompleted = completion

// ----------
@sylvia-tencent-wmt
Copy link

I encountered the same issue too.

  1. First time login will display webview (I'm using iPad, not sure if this behavior was correct).
  2. After entered the login credentials it login successfully, but it stayed in the Facebook home page, instead of redirecting to my app.
  3. I have to cancel to dismiss the webview, subsequent login was successful and was able to redirect to my app.

The above issue can be reproduced by logout from my app, and clear the Safari web history.

Facebook iOS SDK version: 17.0.0
Device version: iOS 17

@MountainTao
Copy link

I encountered the same issue too.
This bug occurs in the latest version of the Facebook app, version: 472.0.0.25.107
If Facebook is already logged in, it is ok.
If Facebook is not logged in, after clicking the login button, it will stay in the Facebook app directly without jumping back to our app, and the "open:url" api in the appdelegate file will not be triggered.

@jksmx
Copy link

jksmx commented Sep 20, 2024

Facebook iOS SDK 17.0+ recommend limited login . If you use limited login ,won't open facebook app . Just login through webview.

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

4 participants