Common Session for application and web browser

I have a query regarding to session maintain between application and web browser.

I’m developing an iPhone application and there is also one website (in wordpress) same for this application.

Read More

My question is , is it possible to show user login in mobile’s web browser if he/she is login into application from same mobile device?

In short, I want to know where is this session stored? In application or in device? If it is in device then how can I check same for the web browser?

Related posts

Leave a Reply

1 comment

  1. Cookies are stored per app, not per device. Safari has its own sandbox whereas each native app runs in its own sandbox, otherwise Safari’s security model would be compromised.

    So for your scenario, this is how you should be able to make it work (I haven’t tried it though):

    1. In your mobile app, open website in Safari. Send a HTTP header to tell the web server that this hit is coming in from your native app
    2. If you are already logged in via Safari, then your server will identify the user. Code your server to send back a redirect response (only in case when the request is from native app). This redirect response will contain a session cookie / auth_token with it. Also, the redirect location would use the iOS custom url scheme, e.g. myapp://mydashboard
    3. In your native app, register the app as the handler of that custom url so that it can catch and handle the redirect appropriately
    4. In subsequent requests from the native app, send the session cookie / auth_token

    Hope it helps.