Facebook and other apps allow you to log out without an active internet connection. We have to make the decision to allow this or not, but I think that you should ask for an internet connection to log out. This is mostly because the server could unregister your device for push notifications, although the token has an expiration.

What is the best approach to this?

  • Have you considered allowing the user to press a "Log Out" button without an internet connection and have it send a "log out" notice to your server once internet access is regained? This would allow for the benefits you cite (unregistering for push notifications, etc) while not forcing the user to wait and remember to log out later. – thunderblaster Apr 27 '17 at 2:06

The answer here is definitely yes. For example, if I log into a friends computer (not using an incognito window of course. Many people don't even know incognito tabs exist) and I run out of internet, because I'm using metered internet of course, then I wouldn't be able to log out until the next time I use my friends computer.

Now we can all imagine what our 'friend' will end up doing, no? (For those who don't know he/she will probably post something inappropriate on my wall/timeline/whatever/etc.

Anyway, it is then a very good idea to setup a method for users to log out even when there isn't internet. To avoid unwanted posts and/or drama.

  • I agree with you, but your case is very particular for a computer as a client; one of the main reason why am I asking this question is because of push notifications in mobile, maybe with sensitive information. – rhdez.g May 5 '17 at 19:16
  • @rhdez.g What type of sensitive info. Also, isn't having the notifications turned off a good thing. Since the user has already logged out. – Kitanga Nday Nov 26 '17 at 12:42

This actually depends. Given that on the web, an active Internet Connection is required. Meaning, that if you try to invoke: /logout or /exit.php, or any of website resource, you'll end up with a "Server not found" message or on mobile you might see a "No Internet Connection" message. This means that the file e.g. a logout.php cannot be accessed, leaving you still logged-in, because the PHP (or any back-end responsible code) cannot execute and make sure the user gets logged out. If this is solely a app for mobile, then internal code executing mobile-side will take care of the logout, eventually, the real-time API on the webserver, will discover that communication has died between this user and the platform, and eventually kill the session.

See this as well: Logging out of mobile app without Internet connection

TO add more, some services and platforms, e.g. Spotify work offline (airplane mode), meaning, you can logout or login and play your favorite music and songs from your personal lists. Once online, the app reconnects and checks for any updates or anything that might be useful.

  • So how does Facebook app in iOS for allow log out without internet connection and when internet connection backs again, you won't receive push notifications in that device. – rhdez.g May 5 '17 at 19:19

For security and privacy reasons. Yes, they should be.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.