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

User Cancelled Dialog (4201) error when logging in #915

Open
Dave-Richardson opened this issue Feb 2, 2015 · 12 comments
Open

User Cancelled Dialog (4201) error when logging in #915

Dave-Richardson opened this issue Feb 2, 2015 · 12 comments

Comments

@Dave-Richardson
Copy link

Hello,
for some reason I keep getting the "User Cancelled Dialog (4201)" error when trying to login.

facebookConnectPlugin.login(['public_profile'],
function(msg) { alert(JSON.stringify(msg)); },
function(msg) { alert(JSON.stringify(msg)); }
);

What could be the reason for this? I've tried Android 4.1-5.0 and it's the same message.

@Dave-Richardson
Copy link
Author

Figured it out. It happens when you use "singleInstance" for "AndroidLaunchMode". Any way to fix this?

@justlo0king
Copy link

Check if Facebook app is working correctly on your device. Had same problem while there was "no connection" in Facebook app due to limited permissions. Fixing permissions (and Facebook app working) resolved the issue.

@justinaslelys
Copy link

I had similar issued when my phone's date was incorrect, that caused problems with certificates.

@KeKs0r
Copy link

KeKs0r commented Jul 10, 2015

Did you guys find a solution for the issue?

@infiniteloopltd
Copy link

This may seem like an obvious problem. But I got this exact error when I had wifi turned off on the android tablet. So, check you're not in flight mode...

@arcoirislabs
Copy link

Fix found:
We had experienced this issue due to key hashes issue on Android. Probably same is observed in iOS version.
Check this out @Dave-Richardson @dananos @KeKs0r

Problem:-
When we ran the facebook login feature on 4.x platform it was just running good, with correct hash updated in developer console. But the facebook login crashed in Lollipop platforms.

Solution:-
When we checked the adb logcat dump while running our app on 5.x platform, we found that the Facebook SDK generates different hashes for different base Android versions. For example for 4.x platform the hash is same, but the hash for 5.x versions is different. So the login may work on 4.x platforms like on KitKat (4.4) it will work just fine, but it may give 4201 error on Lollipop.
All you have to do is find the new key hash in the dump right in the ApiException line of adb logcat. And the correct hash value is displayed in same line in developer console. Just do not delete the hash which worked in previous versions.
Similarly update the hash for 6.x platform on the developer console.
The issue will be solved.
For better stability, follow the Telerik-Verified-Plugins fork of this plugin, it will eliminate the multiple dex issue

@Freundschaft
Copy link

by the way, I found the real issue behind this for me:
calling login works only the first time, after that, subsequent calls to facebook login would result in 4201 user cancelled dialog.
in your code, check first if the user is already logged in with getLoginStatus and only if that fails, run login

@insign
Copy link

insign commented Nov 6, 2016

This ṕroblem was fixed here https://www.npmjs.com/package/cordova-plugin-facebook4

@vomchik
Copy link

vomchik commented Dec 1, 2016

@insign Not working for me on KitKat version

@olixis
Copy link

olixis commented Dec 18, 2016

The problem is with ionic plugin add!!!!

ionic plugin add cordova-plugin-facebook4 --save --variable APP_ID="myid" --variable APP_NAME="meuname" bugged.

cordova plugin add cordova-plugin-facebook4 --save --variable APP_ID="myid" --variable APP_NAME="myname" works!

@erikrossetti
Copy link

Looking in the inspector/ console, the error was that i used the key hash instead app key, when i instaled the plugin in my cordova app.
So, uninstall the plugin cordova-plugin-facebook4, go in this link: https://developers.facebook.com/apps and get the app id and, finally, reinstall the plugin but now with that id that you got in the facebook.
If is was not that, verify the problem in the console, accessing this link: chrome://inspect/#devices, run your app and click in "inspect".

@emgie123
Copy link

The problem is with ionic plugin add!!!!

ionic plugin add cordova-plugin-facebook4 --save --variable APP_ID="myid" --variable APP_NAME="meuname" bugged.

cordova plugin add cordova-plugin-facebook4 --save --variable APP_ID="myid" --variable APP_NAME="myname" works!

saved my day!!! nothing else was working except that, thanks!

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