Facebook Login Not Working On The First Login
aemreb opened this issue · comments
Checklist before submitting a bug report
- I've updated to the latest released version of the SDK
- I've searched for existing GitHub issues
- I've looked for existing answers on Stack Overflow, the Facebook Developer Community Forum and the Facebook Developers Group
- I've read the Code of Conduct
- This issue is not security related and can safely be disclosed publicly on GitHub
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
// ----------