Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Devise: iOS “Add to Home Screen”

When I open my web app on my iOS device, login and restart Safari, I am still logged in.

But when I add this page with "Add to Home Screen", each time I click the icon for that page, I have to login again.

Is there a workaround for this with the Devise gem or is there really no other way but building a native app?

like image 829
karlingen Avatar asked Aug 17 '15 06:08

karlingen


1 Answers

One thing you can try is the following.

You can add something to your DOM, for example hidden div, with the data you need to log user in:

<div id="authentication-div" data-user-id="5" data-user-key="abbbbaafff12899a9a">

Then you fetch that div from javascript and use its data to make authenticated request to your backend. Of course that will work only if your user saved your app to home screen after they have been signed in (and you should reload the page on sign in as well).

like image 89
EugZol Avatar answered Sep 21 '22 17:09

EugZol