CrossGeeks / FacebookClientPlugin

Facebook Client Plugin for Xamarin iOS and Android
MIT License
106 stars 32 forks source link

Failed to login #71

Closed fap0702 closed 3 years ago

fap0702 commented 4 years ago

If you are creating an issue for a BUG please fill out this information. If you are asking a question or requesting a feature you can delete the sections below.

Failure to fill out this information will result in this issue being closed. If you post a full stack trace in a bug it will be closed, please post it to http://gist.github.com and then post the link here.

Bug Information

Version Number of Plugin: 2.2.1 Device Tested On: Samsung A10 Simulator Tested On: Version of VS: 8.5.5 (mac) Version of Xamarin: 4.6.0.726 Versions of other things you are using: Facebook (269.0.0.50.127) - (installed on the device)

Steps to reproduce the Behavior

I try to log in from my app developed using:

await CrossFacebookClient.Current.RequestUserDataAsync(...)

and it never comes to this event:

CrossFacebookClient.Current.OnUserData += ...

Expected Behavior

get to this event

CrossFacebookClient.Current.OnUserData

with the following status:

FacebookActionStatus.Completed:

Actual Behavior

I understand that it opens the Facebook app and shows me a red message indicating "Error starting session"

Code snippet

CrossFacebookClient.Current.OnUserData += (s, a) => { FacebookUser fbUser = null;

            switch (a.Status)
            {
                case FacebookActionStatus.Completed:
                    JObject fbProfile = JObject.Parse(a.Data);
                    fbUser = new FacebookUser
                    {
                        Id = fbProfile["id"].ToString(),
                        FirstName = fbProfile["first_name"].ToString(),
                        LastName = fbProfile["last_name"].ToString(),
                        Email = fbProfile["email"].ToString(),
                        Picture = fbProfile["picture"]["data"]["url"].ToString()
                    };

                    break;
            }

            callMethod(fbUser);
        };
        //await CrossFacebookClient.Current.LoginAsync(new string[] { "email" });
        await CrossFacebookClient.Current.RequestUserDataAsync(new string[] { "email", "first_name", "gender", "last_name", "birthday", "picture" }, new string[] { "email" });

Observation

I have noticed that if I deactivate or uninstall the facebook app it shows me the login in browser mode and I can log in successfully. there is some way to force the plugin to always use the web environment and not to use the installed app for the login

Screenshotst

Screenshot_20200513-121136

rdelrosario commented 4 years ago

It seems you are missing Facebook portal configuration

jrthurler commented 4 years ago

I'm having the same issue! If I logout from Facebook App and try to login again from my app, I can log in successfully, but sometimes I receive the same message displayed above.

jrthurler commented 4 years ago

This is my code used to login:

var fbLoginResponse = await CrossFacebookClient.Current.LoginAsync(new string[] { "email", "public_profile" });

jrthurler commented 4 years ago

FB Error

fap0702 commented 4 years ago

I managed to solve it, I don't know exactly what the solution was but what I did was the following:

Thank you!