GregMc
Posts: 0
Joined: Wed Dec 03, 2014 12:46 am

Conditional start page?

Hi,

In my app I would ideally be able to have 2 different start pages based on some condition. For instance if there is a user session token available I would go directly to the home page of the app, if there is no session token available the user is taken to a login/registration page. This seems like it would be a common use case as many/most mobile apps do not require authentication on each start. Is there a way to do something like this in appery currently?

If not would the recommended way be to just have a dummy page that shows something like the app logo and perform the check for the session token while that page is displayed?

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

Conditional start page?

Hi Greg,

Yes your suggestion is correct. So:

  1. Start from "load page".

  2. On the load page - check validity of the current session token(with help of some service).

  3. If session token is correct navigate to "Correct" page.

  4. if session token isn't correct - navigate to "Other" page.

    Regards.

GregMc
Posts: 0
Joined: Wed Dec 03, 2014 12:46 am

Conditional start page?

Thanks Yuri. A follow up question, I was planning to just test for the presence of a session token in local storage. When you mention to check the validity of the session token by using a service how would you do this? Right now I am just using the default login service which returns the token with user & password matching what is stored in the user collection in the DB.

So for a first login you have the user/password validation to receive the token. But once the token is received and placed in local storage is there some other validation that can be done when the user starts the app again other than just checking for the presence of a session token? Would storing the latest session token per user in the users table and checking this against the token in local storage be a way to do this?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Conditional start page?

Hello!

1) you can call login service every time you are not sure if the session token is valid
or
2) you can call a service like Yurii said, for instance a query service for users, or list service for users, without token this services doesn't work

Return to “Issues”