Kristof de Block
Posts: 0
Joined: Tue Aug 05, 2014 4:01 pm

Auto login users

Is there a way to save the user data on my phone and have a auto login function?

Thx

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Auto login users

Hello Kristof,

Please look at this link, it should help: https://getsatisfaction.com/apperyio/...

Kristof de Block
Posts: 0
Joined: Tue Aug 05, 2014 4:01 pm

Auto login users

Thx

I am a newbie so I have no idea where I need to start to link the following things

  1. session_id - is empty
  2. Login service invoked and as result - session_id is filled.
  3. Event "session expired" - is triggered.
  4. logoutService invoked
  5. session_id - is cleared and user interface redirects to non-loged page(for example - login page).
Kristof de Block
Posts: 0
Joined: Tue Aug 05, 2014 4:01 pm

Auto login users

Is this the way to add these local storages ?

Image

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Auto login users

Kristof,

Could you please specify, do you want autologin in the sense, that the user can enter login/password once and then he will no longer be prompted to login when he open the app again? Or do you mean, to automatically perform autologin when session_token is expired?

Kristof de Block
Posts: 0
Joined: Tue Aug 05, 2014 4:01 pm

Auto login users

I want to create it where peope need to input it once so they don't need to login every time .

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Auto login users

Hi Kristof,

In this case you need to implement login page and on "login" button you need to store "login" and "password" in LSV.

Here is code to store it:

pre
//Note you need to replace "loginInput" with your login input component name.
var login = Apperyio("loginInput");

//Note you need to replace "passInput" with your password input component name.
var pass = Apperyio("passInput");

localStorage.setItem("login", login);
localStorage.setItem("pass", pass);

/pre

Then you need on login page "page show" event verify if there these values in LSV and if so - invoke service without user enter this credentials.

Here is code to invoke login service:

pre

var login = localStorage.getItem("login");
var pass = localStorage.getItem("pass");

if(login)
loginService.execute({data: {username: login, password: pass} });

/pre

Regards.

Vinny B
Posts: 0
Joined: Fri Aug 22, 2014 2:22 pm

Auto login users

Hello Yurii

the code works great on the App Tester APP "APPERY.io Tester" but doesnt work as an APK on my android galaxy phone. it just says object Object does not exist.

I hit ok then enter username and password then click LogIn. I hit the back button on the phone and get the error or I close the app and reopen it right away and get the error.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Auto login users

Hi Vinny,

You need to debug code and define what exactly line of code gives you this error.

Regards.

Vinny B
Posts: 0
Joined: Fri Aug 22, 2014 2:22 pm

Auto login users

It does not work when i hit test from the dashboard.

1) first is set the field name loginUsername
Image
2) I added two alerts
Image
3) Then I click the LogIn Button and i get an object error
Image

Any Idea what I am doing wrong?

Return to “Issues”