Facebook: The parameter app_id is required

1

It turns out that I am developing an application using Xamarin for Android consumption and well, the problem is when I want to authenticate my app with Facebook, I followed this tutorial (I used the Xamarin.Auth package) link but I got the following error:

  

     

You did not sign in: You did not sign in. Sign in and try again.

Later I continued searching the Internet and now I have the following:

  

     

The parameter app_id is required

These are the methods I used for the request

   private void FacebookLogin(object sender, System.EventArgs e)
        {
            var autorizacion = new OAuth2Authenticator(
                clientId: "1933406530283189",
                scope: "",
                authorizeUrl: new Uri("https://m.facebook.com/dialog/oauth?"),
                redirectUrl: new Uri("http://www.facebook.com/connect/login_success.html#"));

            autorizacion.Completed += FacebookAuth_Completed;
            var ui = autorizacion.GetUI(this);
            StartActivity(ui);

        }

        private async void FacebookAuth_Completed(object sender, AuthenticatorCompletedEventArgs e)
        {
            if (e.IsAuthenticated)
            {
                var solicitud = new OAuth2Request(
                    "GET",
                    new Uri("https://graph.facebook.com/me?fields=name,birthday"),
                    null,
                    e.Account
                );

                var respuestafacebook = await solicitud.GetResponseAsync();
                var fbJson = respuestafacebook.GetResponseText();
                var fbUser = JsonConvert.DeserializeObject<Cuenta>(fbJson);

                // var nombre = fbUser.Nombre;
                // var id = fbUser.Id;
            }
        }

PD. I have already been able to access but is stunned in this part:

  

var answerfacebook = await request.GetResponseAsync ();

    
asked by Antonio Labra 12.06.2018 в 09:02
source

1 answer

1

In the variable client_id you must assign the Facebook id app which I suppose you have verified:

clientId: {app-id}

but the values of AuthorizeUrl and RedirectUrl must be:

https://m.facebook.com/dialog/oauth/

and

https://www.facebook.com/connect/login_success.html

Therefore assign them to your FacebookLogin() method:

  private void FacebookLogin(object sender, System.EventArgs e)
        {
            var autorizacion = new OAuth2Authenticator(
                clientId: "1933406530283189",
                scope: "",
                authorizeUrl: new Uri("https://m.facebook.com/dialog/oauth/"),
                redirectUrl: new Uri("https://www.facebook.com/connect/login_success.html"));

            autorizacion.Completed += FacebookAuth_Completed;
            var ui = autorizacion.GetUI(this);
            StartActivity(ui);

        }
    
answered by 12.06.2018 в 18:26