For our new Windows 10 application (C# + XAML) we are using the new https://github.com/Microsoft/winsdkfb/ login, however since we have migrated to this login I am having no luck with facebook login.
We are using FBResult result = await sess.LoginAsync(permissions);
and I am getting this error all the time: "Not Logged In: You are not logged in. Please login and try again."
My code is litteraly a copy and paste from the samples they did on github: I have checked my SID and FacebookAppId and they are the same on both the app and the Facebook website.
public async Task<string> LogIntoFacebook()
{
//getting application Id
string SID = WebAuthenticationBroker.GetCurrentApplicationCallbackUri().ToString();
//// Get active session
FBSession sess = FBSession.ActiveSession;
sess.FBAppId = FacebookAppId;
sess.WinAppId = SID;
//setting Permissions
FBPermissions permissions = new FBPermissions(PermissionList);
try
{
// Login to Facebook
FBResult result = await sess.LoginAsync(permissions);
if (result.Succeeded)
{
// Login successful
return sess.AccessTokenData.AccessToken;
}
else
{
// Login failed
return null;
}
}
catch (InvalidOperationException ex)
{
SimpleIoc.Default.GetInstance<IErrorService>().ReportErrorInternalOnly(ex);
return null;
}
catch (Exception ex)
{
SimpleIoc.Default.GetInstance<IErrorService>().ReportErrorInternalOnly(ex);
return null;
}
return null;
}
by doing this:
//getting application Id
string SID = WebAuthenticationBroker.GetCurrentApplicationCallbackUri().ToString();
it is generating me an SID that looks like this:
ms-app://s-1-15-2-0000-bla-bla-bla-667/
so I tried adding ms-app:// to the facebook developer settings page but it did not want it, so I tried removing ms-app:// from the SID when passing it to WinAppId
but still no luck
I have filled the field Windows Store SID wih My FBAppId :
does anyone have this issue?
Edit 1: My code is copy and paste from here: http://microsoft.github.io/winsdkfb/
Edit2: playing the samples from Microsoft my issues is coming from my Application Id. I did follow step 6: (Enable OAuth login)
After trying everything and NOT wanting to use WebAuthentificationBroker I have found the solution.
Go on the Facebook Developer website: https://developers.facebook.com
Then:
Go to your app name -> Settings -> Advance:
Under: Valid OAuth redirect URIs you need to add: https://www.facebook.com/connect/login_success.html
Save and you are good to go now!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With