# Ionic 2 - Remember logged-in user when closing and opening app

**URL:** <https://forum.ionicframework.com/t/ionic-2-remember-logged-in-user-when-closing-and-opening-app/75907>\
**Category:** ionic-v3\
**Created:** [January 11, 2017, 4:51pm UTC](https://forum.ionicframework.com/t/ionic-2-remember-logged-in-user-when-closing-and-opening-app/75907 "2017-01-11T16:51:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![IvanLencina](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/ivanlencina/32/106005_2.png) [@IvanLencina](https://forum.ionicframework.com/u/IvanLencina)\
**Post date:** [January 11, 2017, 4:51pm UTC](https://forum.ionicframework.com/t/ionic-2-remember-logged-in-user-when-closing-and-opening-app/75907/1 "2017-01-11T16:51:35Z")

</div>

Hello guys,

I have an ionic 2 app that handles logging of users with facebook and using the login method with firebase email. It works perfectly, but when I close the app and re-open it on my device, I must log in again.

How could you do to remember that the user is logged in?  
I can think of keeping the app in the background.  
Another way could be to save the email when logging in and then trying to log in automatically with that email when you open the app.  
Any ideas? Did someone do something like that? If someone can give me a hand I would be more than grateful !!

Regards,  
Ivan

---

<div class="post-metadata">

**Author:** ![aaronksaunders](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/aaronksaunders/32/13729_2.png) [@aaronksaunders](https://forum.ionicframework.com/u/aaronksaunders)\
**Post date:** [January 12, 2017, 6:07am UTC](https://forum.ionicframework.com/t/ionic-2-remember-logged-in-user-when-closing-and-opening-app/75907/2 "2017-01-12T06:07:28Z")

</div>

if you are doing the firebase authentication correctly, it should be persisting the user for you and on relaunch of the app you can just check of there already is a user session

“Get the currently signed-in user” - [https://firebase.google.com/docs/auth/web/manage-users](https://firebase.google.com/docs/auth/web/manage-users)

---

<div class="post-metadata">

**Author:** ![IvanLencina](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/ivanlencina/32/106005_2.png) [@IvanLencina](https://forum.ionicframework.com/u/IvanLencina)\
**Post date:** [January 12, 2017, 12:53pm UTC](https://forum.ionicframework.com/t/ionic-2-remember-logged-in-user-when-closing-and-opening-app/75907/3 "2017-01-12T12:53:40Z")

</div>

I used native storage to persist user information: [https://ionicframework.com/docs/v2/storage/](https://ionicframework.com/docs/v2/storage/)  
but thanks, that should work and even better than I implemented so i’ll try it

---

<div class="post-metadata">

**Author:** ![Naeem90](https://avatars.discourse-cdn.com/v4/letter/n/b9e5f3/32.png) [@Naeem90](https://forum.ionicframework.com/u/Naeem90)\
**Post date:** [January 2, 2018, 6:38am UTC](https://forum.ionicframework.com/t/ionic-2-remember-logged-in-user-when-closing-and-opening-app/75907/4 "2018-01-02T06:38:34Z")

</div>

please tell me in ionic 3 where i initlize this function ?

---

<div class="post-metadata">

**Author:** ![Naeem90](https://avatars.discourse-cdn.com/v4/letter/n/b9e5f3/32.png) [@Naeem90](https://forum.ionicframework.com/u/Naeem90)\
**Post date:** [January 2, 2018, 6:39am UTC](https://forum.ionicframework.com/t/ionic-2-remember-logged-in-user-when-closing-and-opening-app/75907/5 "2018-01-02T06:39:01Z")

</div>

get current user funtion  
’

---

<div class="post-metadata">

**Author:** ![christo-takectrl](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/christo-takectrl/32/116832_2.png) [@christo-takectrl](https://forum.ionicframework.com/u/christo-takectrl)\
**Post date:** [January 29, 2018, 9:18am UTC](https://forum.ionicframework.com/t/ionic-2-remember-logged-in-user-when-closing-and-opening-app/75907/6 "2018-01-29T09:18:54Z")

</div>

Would advise against using local storage, unless you are hashing the passwords. If you are using something like firebase, it caches user auth info for you.
