Facebook login always gets cancelled but nothing has changed within my codebase and its working since it was released
Checklist before submitting a bug report
- [X] I've updated to the latest released version of the SDK
- [X] I've searched for existing Github issues
- [X] I've looked for existing answers on Stack Overflow, the Facebook Developer Community Forum and the Facebook Developers Group
- [X] I've read the Code of Conduct
- [X] This issue is not security related and can safely be disclosed publicly on GitHub
Java version
11
Android version
Android 11, Android 12
Android SDK version
14.1.1
Installation platform & version
gradle
Package
Login
Goals
Login via facebook login sdk
Expected results
The facebook login sdk should proceed and return the result
Actual results
The callback always triggers cancelled
Steps to reproduce
- Create a jetpack compose project
- integrate the login sdk
Code samples & details
if (context is ActivityResultRegistryOwner) {
val callBackManager = CallbackManager.Factory.create()
val loginManager = LoginManager.getInstance()
loginManager.registerCallback(
callbackManager = callBackManager,
callback = object : FacebookCallback<LoginResult> {
override fun onCancel() {
Log.i("spawned", "this always triggers")
}
override fun onError(error: FacebookException) {
if (error.message != null) {
if (error.message == "CONNECTION_FAILURE: CONNECTION_FAILURE") {
showError("Network error, Please check your internet connection.")
} else {
showError("Facebook is not available at the moment. Please try again later")
}
} else {
showError("Facebook is not available at the moment. Please try again later")
}
}
override fun onSuccess(result: LoginResult) {
loginFacebookUser(result.accessToken.token)
}
}
)
LoginManager.getInstance()
.logIn(
activityResultRegistryOwner = context,
callbackManager = callBackManager,
permissions = listOf("email", "public_profile")
)
}
We are facing the same issue. Facebook login always gets cancelled for Android 6.0.1. We are not using jetpack compose but still getting onCancel event for Android 6.0.1.
[fyi] If we uninstall facebook app from device and use web, then we get onSuccess event in Android 6.0.1.
We are facing the same issue too, my sdk version is 12.2.0, and my facebook app version is 382.0.0.33.111. I try in several devices and facebook accounts, but suffer the same issue. And I debug the source code, and found when we call logIn function, the final call is in NativeAppLoginMethodHandler.tryIntent(),following is source code:
protected boolean tryIntent(Intent intent, int requestCode) {
if (intent == null) {
return false;
}
try {
getLoginClient().getFragment().startActivityForResult(intent, requestCode);
} catch (Exception e) {
// We do not know if we have the activity until we try starting it.
// FB is not installed if ActivityNotFoundException is thrown and this might fallback
// to other handlers
return false;
}
return true;
}
and in the LoginFragment we receive the result in onActivityResult, but the param data in the callback is null, and finally triger the onCancel() in FacebookCallback. Is someone know why, and pls tell me how to resolve it?
// data is null
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
loginClient.onActivityResult(requestCode, resultCode, data);
}
same issue last friday always cancelled when facebook app installed, but after uninstalled, has no problem by web login it seems fixed/resumed now
its not fixed yet for some of our users
its not fixed yet for some of our users
we tried downgrading sdk last friday but not work, we did nothing today and it works maybe you need to complain in other ways: https://business.facebook.com/direct-support/ https://developers.facebook.com/support/bugs/
Some account works, and some don't
https://metastatus.com/facebook-login
https://metastatus.com/facebook-login
Nice thanks for the info did not know facebook has page like that
Any solution why fb login not working ?
Any solution why fb login not working ?
The only thing we can do is to wait for facebook to fix the problem
My problem is resolved. It's the problem of my facebook account, which was new registered. when I add some friends in facebook app, explore news and watch videos some while. Then switch to my app to login with facebook, and it works!
We are facing the same issue.
This has been closed because it has been resolved please file a new issue if you are facing this issue