# Ngstorage to persist a login

**URL:** <https://forum.ionicframework.com/t/ngstorage-to-persist-a-login/30887>\
**Category:** uncategorized\
**Created:** [August 20, 2015, 6:05pm UTC](https://forum.ionicframework.com/t/ngstorage-to-persist-a-login/30887 "2015-08-20T18:05:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![angelomrigo](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/angelomrigo/32/90608_2.png) [@angelomrigo](https://forum.ionicframework.com/u/angelomrigo)\
**Post date:** [August 20, 2015, 6:05pm UTC](https://forum.ionicframework.com/t/ngstorage-to-persist-a-login/30887/1 "2015-08-20T18:05:36Z")

</div>

Hi,

I do install ngstorage using bower, is it possible to set some local ou session variable to persist a login?

My goal is that the user does not need to make a new login for a long time from the last login.

```
$scope.$storage = $localStorage;
$scope.$storage.login = "authenticated";

```

Can i persist the $scope.$storage.login variable setting the time to expire ?

---

<div class="post-metadata">

**Author:** ![donsplash](https://avatars.discourse-cdn.com/v4/letter/d/b782af/32.png) [@donsplash](https://forum.ionicframework.com/u/donsplash)\
**Post date:** [March 5, 2016, 11:30pm UTC](https://forum.ionicframework.com/t/ngstorage-to-persist-a-login/30887/2 "2016-03-05T23:30:01Z")

</div>

Where you able to implement this???
