How to use Facebook login on Windows universal platform?

2

I'm trying to mount Facebook login to an app so that it works using the app or website according to the tutorial:

link

It has a similar question, but that does not answer me by limiting the solution to the application only as I understood it: Using Facebook Login on Windows Phone 8.1 1

I just added the xml file to my Facebook application id. I also added the protocol and put this code in my main code:

        protected override void OnActivated(IActivatedEventArgs args)
        {
            base.OnActivated(args);

            // You can setup a event handler to be called back when the authentication has finished
            Session.OnFacebookAuthenticationFinished += OnFacebookAuthenticationFinished;

            var protocolArgs = args as ProtocolActivatedEventArgs;
            LifecycleHelper.FacebookAuthenticationReceived(protocolArgs);
        }

        private void OnFacebookAuthenticationFinished(AccessTokenData session)
        {
            // here the authentication succeeded callback will be received.
            // put your login logic here
        }

However, trying to add Facebook.client I could not and probably because of this, the above functions are not being recognized so I can override.

Does anyone know what might be missing? How do you complete this goal?

    
asked by anonymous 19.03.2016 / 15:55

1 answer

1

In the question it was not clear what tool you are using for communicating with Facebook, then I will deduce that you are using facebook -csharp-sdk . Another interesting option is Facebook Service - UWPCommunityToolkit

Api and configuration of applications that interact with facebook constantly change, so that a uwp application can use facebook login some settings are necessary:

  • Sign up as a developer on the link page.
  • Add an application
  • Download the source here (to generate the SID required by the facebook app)
  • On the Configurações - Básico
  • TheonlyinformationenteredwillbeNomedaAplicação,Emaildecontato,SIDdaWindowsStore(vejacomopegaroSIDparadebugnocódigofontedisponívelnofinaldaresposta)

  • Click +Adicionar plataforma and choose Aplicativo Windows enter SID da Windows Store (pode ser gerado SID para teste, veja como no fonte no final da resposta)
  • In option PRODUTOS choose Login do facebook and configure as image:
  • Aftertheapplicationcreatedandsettingsadded,addtheIddoaplicativogeneratedbyfacebookintheapplication.

    //somenteparatestenãoinformediretamentenoappemproduçãoprivateconststringAppId="XXXXXXXXXXXXX";
    

    Once this is done, your application will already be able to use facebook as a login tool (tested with facebook api version v2.8).

      

    SourceCode:   link

         

    References:
    link    link    link    link

        
    19.02.2017 / 16:53