I am trying to get an authentication by Facebook on a UWP project.
This method keeps failing:
FacebookService.Instance.Initialize(FacebookClientID.Text, FacebookPermissions.Email);
var log = await FacebookService.Instance.LoginAsync();
if (log)
{
return;
}
This method fails with "User cancelled the dialog flow":
FBSession session = FBSession.ActiveSession;
session.WinAppId = SID;
session.FBAppId = APPid;
List<string> permissionList = new List<string>();
permissionList.Add("public_profile");
permissionList.Add("email");
FBPermissions permissions = new FBPermissions(permissionList);
var result = await session.LoginAsync(permissions);
if (result.Succeeded)
{
//do something
}
For creating and configuring FaceBook app that used to UWP client app, you need to refer Facebook Service official document.
The Windows Store SID is a unique value per application generated, and it not tied to the actual store publication. Creating a local application will give you a valid SID that you can use for debugging against Facebook.
Please use the following code get store id.
var id = Microsoft.Toolkit.Uwp.Services.Facebook.FacebookService.Instance.WindowsStoreId;
Remark : From left side menu choose + Add Product Click to add Facebook Login . Ensure you set the following options in the UI:
FacebookService.Instance.Initialize("appid");
if (!await FacebookService.Instance.LoginAsync())
{
return;
}
Update
Problem solved. Apperantly microsoft toolkit based on an old nugget which had to update manually.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.