locked
Facebook authentication fails after 18 to 24 hrs of working RRS feed

  • Question

  • I have external authentication for Facebook in my webapp, and have the right ID and secret key in the web.config file. The external authentication worked for few hours and now it fails.

    Below is the code for the External Login Action Method.  This works for Google, Twitter and LinkedIn.  However, failing for Facebook now.  It worked for FB for about 12 hours. 

    public ActionResult ExternalLogin(string provider, string returnUrl)
            {

                //Added based on internet research
                ControllerContext.HttpContext.Session.RemoveAll();

                // Request a redirect to the external login provider
                return new ChallengeResult(provider, Url.Action("ExternalLoginCallback", "Account", new { ReturnUrl = returnUrl }));
            }

    The above code was added after reading this article in StackOverflow.  http://stackoverflow.com/questions/20180562/mvc5-null-reference-with-facebook-login/20948631#20948631

    Any help?

    Thanks,

    Dan


    • Edited by ZDhananjay Tuesday, March 28, 2017 1:26 PM
    • Moved by Sabah ShariqMVP Tuesday, March 28, 2017 3:40 PM Moved From Visual C#
    Tuesday, March 28, 2017 1:26 PM

Answers

  • Thanks.  I found the ASP.Net forum but having trouble logging in.  The forum is not listed in the Priority Support Forums (https://www.visualstudio.com/my/priority-forums-vse) where you get an answer from Microsoft Engineer in 2 days.  Let me try the ASP.Net forum again.  I will close my request on this forum.
    • Marked as answer by ZDhananjay Tuesday, March 28, 2017 9:17 PM
    Tuesday, March 28, 2017 9:16 PM

All replies

  • Questions related to third party products like Facebook need to be posted in their forums. My gut instinct is that it is using OAuth2 and so what you're getting back is a bearer token. Bearer tokens expire naturally. When they expire you need to send the refresh token back to the server to get an updated bearer token. But this is just a guess. The Facebook forums should be better able to assist you here.
    Tuesday, March 28, 2017 1:59 PM
  • I am building an app in C#, MVC using standard Microsoft provided external authentication tools in Visual Studio 2015 including one for Facebook.  It is not working as expected.  Does the FB forum cover this?  Where is the FB forum?  The solution may be changing code in C# so I posted in this forum.

    • Edited by ZDhananjay Tuesday, March 28, 2017 4:31 PM
    Tuesday, March 28, 2017 4:24 PM
  • I am building an app in C#, MVC using standard Microsoft provided external authentication tools in Visual Studio 2015 including one for Facebook.  It is not working as expected.  Does the FB forum cover this?  Where is the FB forum?  The solution may be changing code in C# so I posted in this forum.
    Tuesday, March 28, 2017 4:33 PM
  • I am building an app in C#, MVC using standard Microsoft provided external authentication tools in Visual Studio 2015 including one for Facebook.  It is not working as expected.  Does the FB forum cover this?  Where is the FB forum?  The solution may be changing code in C# so I posted in this forum.
    Tuesday, March 28, 2017 4:34 PM
  • Please do not bump your thread. This is a violation of the forum rules and will end up getting your thread locked or your posts deleted.

    How FB implements its authentication (OAuth, OAuth2, etc) and which one you're using is a FB question so you'll need to ask them. This is especially true if other identity providers are working correctly. As I mentioned before, it is likely a bearer token refresh that you'll need to implement. They will have the necessary samples to discussion how to refresh their bearer token (assuming you are using OAuth2 in your authentication with them).

    Here's a link to their developer information.

    Here's a link to MS's documentation (for OWIN at least) on how to integrate with them.

    Additionally, if you're having issues with your MVC app you should post in the ASP.NET forums.

    Tuesday, March 28, 2017 5:03 PM
  • I don't think this is a FB issue, as I have configured the FB application on the developer.facebook.com appropriately.  It is a integration issue with MVC app, and with MS OWIN.  I have followed the OWIN instructions and it worked briefly and then stopped working.  There is a bug in OWIN. 

    What questions should be posted to the C# forum?  And how did I bump my thread.  I replied earlier to Sabah's post so he would know about this.  I will post this question to the ASP.Net forum as well.

    • Edited by ZDhananjay Tuesday, March 28, 2017 6:34 PM
    Tuesday, March 28, 2017 6:27 PM
  • "What questions should be posted to the C# forum?"

    C# is for general C# questions unrelated to any UI or other products with their own forums (eg. Office, SQL). Each UI has its own forums. MVC/ASP.NET unfortunately are on a completely different site and therefore have to reposted there. We cannot move them from here.

    "And how did I bump my thread"

    Looking at the posts in this thread I see you posted the same statement 3 times - 3h 36m, 3h 27m, 3h 26m. May have been done on accident or caused by a hiccup in your network. Just wanted to ensure you weren't doing it as we have that problem on occasions.

    Tuesday, March 28, 2017 8:03 PM
  • Thanks.  I found the ASP.Net forum but having trouble logging in.  The forum is not listed in the Priority Support Forums (https://www.visualstudio.com/my/priority-forums-vse) where you get an answer from Microsoft Engineer in 2 days.  Let me try the ASP.Net forum again.  I will close my request on this forum.
    • Marked as answer by ZDhananjay Tuesday, March 28, 2017 9:17 PM
    Tuesday, March 28, 2017 9:16 PM