microsoft / winsdkfb

The Windows SDK for Facebook allows developers to provide Facebook integration for Windows Apps.
Other
182 stars 101 forks source link

Login fails with no ErrorInfo #281

Closed mdstankov closed 5 years ago

mdstankov commented 5 years ago

I currently am making a new project and its currently in dev, i did follow all the steps multiple times from the http://microsoft.github.io/winsdkfb. Years ago i had no problem with this step but that project is lost. this is my login code


FBSession^ sess = FBSession::ActiveSession;
    FBPermissions^ permissions = ref new FBPermissions( m_PermissionList->GetView( ) );

    // Login to Facebook
    concurrency::create_task(sess->LoginAsync(nullptr, SessionLoginBehavior::WebAuth)).then([=](FBResult^ result)
    {
        if( result->Succeeded )
        {
            cfEngineContext::OSBridge( )->PluginNotify( FB_LOGIN_RESULT_SUCCESS_NOTIFY , cfString::Blank( ) , 0 );          
        }
        else
        {
            DumpErrorInfo( result->ErrorInfo );
            cfEngineContext::OSBridge( )->PluginNotify( FB_LOGIN_RESULT_FAIL_NOTIFY , cfString::Blank( ) , 0 );
        }   
    } );

I get the login screen, i put my dev facebook intro, and when it returns it doesn't succeed, and the ErrorInfo is nullptr, and i got no idea where to continue from here as i tried so many random stuff I don't even remember all at this point. (I also tried with different SessionLoginBehavior but seems to only give 4201 error, that gives to everyone else). About the facebook project I think I have followed all the instructions there are to follow. This is for windows store/mobile. And doesnt have its own domain.

johanlindfors commented 5 years ago

This is very strange, since I just tried following the documentation (skipping the Windows Phone ID though) and it works just fine for me. This was leveraging the Nuget packages.

I did however add a line to add the FBAppId to the session.

FBSession^ sess = FBSession::ActiveSession; sess->FBAppId = "";

My test app is a published sample app that I'm using for these purposes.

johanlindfors commented 5 years ago

And it works fine when adding and configuring the _uwp.vcxproj project to the solution and running, no code changes...

mdstankov commented 5 years ago

Maybe Im messing up something in the project configuration here, because i do get to enter my user/password in the prompt, but the return is an error - like if i dont have permission, or invalid access tokens or anything, its just empty error and no success.

image

johanlindfors commented 5 years ago

I have the following URL as Valid OAuth Redirect URI:

https://www.facebook.com/connect/login_success.html

mdstankov commented 5 years ago

I tried with that too + with both and each of them. Sadly same result. Im sorry i forgot to add in my first post that in the visual studio output window i do get this like "FBResult destructor file:///dev/null?access_token=EAADk4VQ8Ygg****D&data_access_expiration_time=1570103036&expires_in=5182428"

but otherwise nothing changed. I also tried to use PhoneProductId as a WinAppId as one of the suggestion in the instructions were duting testing.. same result

mdstankov commented 5 years ago

Also the app is still in development status? can that cause an issue too? Although last time i used this plugin i don't remember having such trouble - that was 1 year ago. only that i was forced to use only essionLoginBehavior::WebAuth)

johanlindfors commented 5 years ago

So you do get a valid token, but the SDK never asynchronosly returns this information to you, is that correct? Are you using the latest develop-branch or the NuGet packages, have you made sure you are using the latest NuGet packages? I am targetting Windows SDK 10.0.18362.0, and have min version of 10.0.17763.0. Using Visual Studio 2019 (v142)… I will try and create a minimal shareable sample of the code that works for me, and then you could potentially try that on your end...

mdstankov commented 5 years ago

Omg, yes it was a version mishap with nuget. Im so sorry for wasting your time, and thank you so much for the help @johanlindfors.