Hybrid View

  1. #1
    Sencha User
    Join Date
    Aug 2012
    Posts
    8
    Vote Rating
    0
    agobert is on a distinguished road

      0  

    Default Unanswered: Forcing re-authentication after offline usage on iOS devices?

    Unanswered: Forcing re-authentication after offline usage on iOS devices?


    Hi everyone!

    My Sencha Touch application resides on an Apache server with server-side basic authentication, i.e. upon the first connection, the user has to enter his/her credentials via the browser prompt. The application then gets cached using the cache.manifest and provided HTML5 mechanisms. If I take my iOS device offline and re-open the page, I can see and use the cached version just fine.

    When taking my device online again, it is always using the cached version of my page but I'd rather like to sync the cache with the server (which, of course, requires a re-authentication with the server).

    Is it possible to somehow force the user to re-authenticate his/herself on startup? Or am I doing something entirely wrong and the source of the problem is not the authentication?

    [EDIT]
    The interesting thing is that it works as intended when only using the Safari browser, because it seems to cache the credentials too. If I, however, install the App to my homescreen, I still only get the cached version.

    I am glad for every advice!

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,549
    Vote Rating
    873
    Answers
    3567
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    What happens if you do an Ajax request? Will it fail and with a status code that says you need to auth?

    I personally never use basic auth as passwords are sent in plain text, it has no security really.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Aug 2012
    Posts
    8
    Vote Rating
    0
    agobert is on a distinguished road

      0  

    Default


    Hey,

    thanks for your answer. I know that basic auth is not secure at all, however, I am forced to use it since the server uses the provided credentials to set several access permissions for the user, and I have no influence on its architecture. Additionally, the user in our scenario will only reach the server through a VPN.

    Unfortunately I can't really see what's going on since I don't have a debug console when starting the app from the homescreen (undecorated Safari) and it works as intended when using the "normal" Safari.

    It has to have to do with authentication and caching, because, if I don't use the cache.manifest, the undecorated Safari requests the credentials each time I open the app from the homescreen.

    Regards!

  4. #4
    Sencha User
    Join Date
    Oct 2012
    Posts
    10
    Vote Rating
    0
    RoxburySoftware is on a distinguished road

      0  

    Default


    I am having the same issue. I use an Ajax request to post username and password to the server. I can pull it up just fine in Safari. When I bookmark to the home screen it always works the first time. But when I pull the bookmark back up it appears iOS goes into some kind of offline mode that doesn't happen in Safari. The result code for the failure is 0 and my server logs don't show any requests.

    I have researched this quite a bit. Going to far as to change my cache manifest to cache.manifest from cache.appCache (I used sencha cmd 3 and touch 2.1 for the app running on iOS 6.01) as well as changing the apple-mobile-web-app-capable to no and making sure that the apple-touch-icon references all show up in my root directory. That was part of a tip for someone using a mapping application that wasn't working right.

    I suspect Apple changed how these ran in iOS 6 and just hasn't told anybody. But until I find a work around I have no choice but to run the app in the browser.

  5. #5
    Sencha User
    Join Date
    Aug 2012
    Posts
    8
    Vote Rating
    0
    agobert is on a distinguished road

      0  

    Default


    Hi there,

    the issue still persists and I am forced to disable the cache manifest completely. I may note that it makes no difference whether I use iOS 5 or 6.

    I am looking forward to a solution.

  6. #6
    Sencha User
    Join Date
    Oct 2012
    Posts
    10
    Vote Rating
    0
    RoxburySoftware is on a distinguished road

      0  

    Default


    Quote Originally Posted by agobert View Post
    Hi there,

    the issue still persists and I am forced to disable the cache manifest completely. I may note that it makes no difference whether I use iOS 5 or 6.

    I am looking forward to a solution.
    I find it interesting that you have the same issue on iOS 5. I did a ton of research and it appears that Apple did in fact break something in Safari. It appears that iOS 6 cache's Ajax calls. Which in this case just doesn't submit at all. Other devs seem to indicate that early betas of 6.1 fix this issue. So I imagine if it still doesn't work in 6.1 then it's a Sencha bug instead of an Apple bug which it looks to be at this point.