Microsoft winsdkfb You are not logged in. You are not authorized. Please log in and try again. C # WinRT

For our new Windows 10 application (C # + XAML) we use the new https://github.com/Microsoft/winsdkfb/ login, however, since we transferred this login I was unlucky with facebook login.

We use FBResult result = await sess.LoginAsync(permissions); and I get this error all the time: "Not logged in: you are not logged in. Please log in and try again."

enter image description here

My code copies and pastes from the samples they made on github: I checked my SID and FacebookAppId, and they are the same on both applications and on 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 the following:

 //getting application Id string SID = WebAuthenticationBroker.GetCurrentApplicationCallbackUri().ToString(); 

it generates me a SID that looks like this: ms-app: // s-1-15-2-0000-blah-blah-blah-667 / so I tried to add ms-app: // to the facebook developer settings page, but he didn’t want it, so I tried to remove ms-app: // from the SID, passing it to WinAppId , but still no luck

enter image description here

I filled out the Windows Store SID wih My FBAppId field: enter image description here

Does anyone have this problem?

Edit 1: My code is copied and pasted from here: http://microsoft.imtqy.com/winsdkfb/

Edit2: playing samples from Microsoft, my problems come from my application id. I did step 6: (Enable OAuth login)

  • Select the application you’ve created on developer.facebook.com.
  • Click "Settings" in the menu on the left.
  • Click the Advanced tab.
  • In the "OAuth Settings" section, enable "Client OAuth Login" and "User Login to the OAuth Standalone Browser".
  • Click "Save Changes."
+5
source share
1 answer

Having tried everything and NOT wanting to use WebAuthenizationBroker, I found a solution.

Go to the Facebook developer website: https://developers.facebook.com

Then:

Go to your application name → Settings → Advance:

Q: Valid OAuth redirect URIs you need to add: https://www.facebook.com/connect/login_success.html

Save and you will go well now! enter image description here

+9
source

Source: https://habr.com/ru/post/1242031/


All Articles