Facebook Login for Windows Phone 8.1

后端 未结 2 1701
花落未央
花落未央 2020-12-17 02:28

I am trying to figure out a simple code for logging in facebook from a Windows Phone 8.1 app (C#).

As the Facebook Client from NuGet doesn\'t target Win

2条回答
  •  無奈伤痛
    2020-12-17 02:52

    In the Package.appxmanifest file, go to 'Declarations' Tab and add a Protocol Declaration.

    In the Name Field, enter your Microsoft product id as 'msft-PRODUCT_ID' [product id without dashes].

    In the App.xaml.cs file, add the following code

        protected override void OnActivated(IActivatedEventArgs args)
        {
            if (args.Kind == ActivationKind.Protocol)
            {
                ProtocolActivatedEventArgs eventArgs = args as ProtocolActivatedEventArgs;
    
                Uri responseUri = eventArgs.Uri;
    
               //Now you can use responseUri to retrieve the access token and expiration time of token
    
            }
    
            base.OnActivated(args);
        }
    

提交回复
热议问题