Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8574911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:34:55+00:00 2026-06-11T19:34:55+00:00

I have been struggling to get OAuth to work on my MVC4 mobile application.

  • 0

I have been struggling to get OAuth to work on my MVC4 mobile application.

I basically

  1. Created an MVC4 Mobile application
  2. Created an MVC4 Web application
  3. Copied the AccountController, AccountModel, InitializeSimpleMembershipAttribute and all account views into my MVC4 Mobile application
  4. Enabled Google and Facebook OAuth providers
  5. I also ensured RoleManager was initialized according to simplemembershipprovider-not-working, although I do not think that was important. ( I needed it for some role-based security I was testing)
  6. Disabled ajax ( I think) by setting data-ajax=”false”:
    using (Html.BeginForm("ExternalLogin", "Account",new RouteValueDictionary { { "ReturnUrl", ViewBag.ReturnUrl } }, FormMethod.Post, new Dictionary<string, object> { { "data-ajax", false } })) (This did not seem to have any effect on the page – so I may be doing something wrong here…)

I can get to the LogIn view /Account/Login, and when I click the google button, the debugger breaks into public ActionResult ExternalLogin(string provider, string returnUrl)

However – the public ActionResult ExternalLoginCallback(string returnUrl) is never hit.
Visually, I get the jquery mobile “page loading” animation – then I get “Error Loading Page”

I have two questions:

  1. How can I get more information when I try to figure out what happens?
  2. How can I get OAuth working on my MVC4 mobile site?

BTW: Both sites target .Net4.0

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T19:34:56+00:00Added an answer on June 11, 2026 at 7:34 pm

    OK – so I figured out the answer – the cuplrit was indeed the ajax in jQuery mobile.

    I modified my _layout.cshtml so that it can render a custom script after loading jQuery, but before loading jQuery mobile:

        @Scripts.Render("~/bundles/jquery","~/scripts/RemoveHashFromWindowLocation")
        @RenderSection("beforeJqueryMobile", required: false);
        @Scripts.Render( "~/bundles/jquerymobile")
        @RenderSection("scripts", required: false)
    

    Then I modified my Login.cshtml so that it contains the section:

    @section BeforeJqueryMobile {
        @Scripts.Render("~/scripts/disable-ajax.js")
    }
    

    And finally, I added the following to my scripts folder:

    disable-ajax.js:

    $(document).bind("mobileinit", function () {
        $.mobile.ajaxEnabled = false;
    });
    

    RemoveHashFromWindowLocation.js: (Thanks to Facebook Oauth Login With Jquery Mobile #_=_)

    if (window.location.hash == "#_=_")
        window.location.hash = "";
    

    Voila – OAuth working with jQuery mobile. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been struggling to get an web application to run in the root
I have been struggling quite a bit to get this JQgrid to work with
I have been struggling with a problem trying to get PLJava to work on
I have been struggling to get my jquery call to a webmethod to work.
I have been struggling to get the emailing to work in Django for logging
I have been struggling to get this to work all day and finally got
I have been struggling all afternoon trying to get a simple mailto: tag to
I have been struggling with Core Data sigh so I decided to work this
I have been struggling with getting this to work properly. I am trying to
I have been struggling to get fetched properties working correctly in my app and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.