1

So I'm doing mobile development, specifically app for android (currently), and I have a part where when user clicks one item on the list, it open up the browser and redirects to the selected link. This part it's working, but when I go back to the app, the current session is gone and I need to login to the app again. How do I retain the session?

I'm using angularjs, html, and ionic framework in development.

Satej S
  • 2,113
  • 1
  • 16
  • 22
JC Borlagdan
  • 3,318
  • 5
  • 28
  • 51

1 Answers1

0

This happens because you did not store your username and loginId in your app.

Each and every user have a unique loginId you should store it locally and call it on where you need. so that when ever the user refresh the page or do something it will stay and show the same position where you are here.

Here is an good example for Authentication Stack Question

here is a nic Raboy blog says how to store it in locally.

Take a look at here Complete Guide for User Authentication With AngularJS and ionic .

Hope it will help you.

Community
  • 1
  • 1
Mohan Gopi
  • 7,606
  • 17
  • 66
  • 117
  • I did, i have a service that holds the data during the session.. i can navigate through different templates of my app, the only issue is when i click on a link which opens up the default browser of the mobile, when i go back to the app, it's logged out – JC Borlagdan Jun 08 '16 at 09:58
  • i am not getting this point **when i click on a link which opens up the default browser of the mobile, when i go back to the app, it's logged out** node some more explaintion – Mohan Gopi Jun 08 '16 at 10:04
  • so there's a page where there are list of titles of news, wherein when user clicks on a news, it will show up in the browser NOT ON THE APP. and YES mine is workin, it opens up the browser, but when i'm done reading the news, i will close the browser, so will be back to the APP but when i get back, i need to login again. – JC Borlagdan Jun 08 '16 at 10:12
  • ok i am dont know why this happen but i think you better console.log that link that takes you to device browser and then check what is going on before and after the borwser open and close so that you can get an idea what is going on like that – Mohan Gopi Jun 08 '16 at 11:56