zquestz / omniauth-google-oauth2

Oauth2 strategy for Google
1.46k stars 414 forks source link

User session expires often on mobile / tablet #371

Closed nburt closed 5 years ago

nburt commented 5 years ago

I'm not sure if this is the right repo for this question, please feel free to point me somewhere else if that's more appropriate.

We have an internal application that uses omniauth-google-oauth2 and devise for authentication. We have a standard implementation and use devise's authenticate_user! method in our controllers that are behind auth to check if users are signed in and if not redirect them to our login page.

On desktop, everything works great and user sessions last for 2 weeks (based off our company google account policy) however our users consistently encounter issues on mobile (Android and iOS) and Android tablets. In my testing it seems like even after just a few minutes of the device going to sleep when I open it back up and visit the site I'm prompted to login again. I'm still signed into my Google account so I don't need to enter my email/password and I'm automatically redirected after clicking the button.

Based off this support page it seems like desktop settings won't apply to mobile browsers however I'm not sure if this is applicable in this case.

Does anyone know of a workaround here?

Thanks

zquestz commented 5 years ago

It is possible that offline mode is what you need. More docs are available at https://developers.google.com/identity/protocols/OAuth2WebServer#offline

Other than that I don't have other suggestions. Unfortunately there is no way to specify the amount of time that the login should be valid for. =(