App variable, instead of initial view?

HI im looking for someone with knowledge, on whether or not using an app variable, is equally ‘safe’ as using the initial view.

In general, i need a way to know when a user is singed in, for using the same page for signed in an unsigned users and differentiating components between them, using the app variable and visibility.

thank you in advance.

I don’t know about why you’re asking about Initial View, but if you are using an Auth Token (from Xano for example), then that Token is supposed to get stored in an App Variable (and potentially stored in Local Storage for when the user comes back into the app). Every time you make a API REST call somewhere that needs authorization, you just point to the App Var.

So I’d assume thats “safe” as thats the suggested method.

1 Like

@Dimos_Vamvourellis it is very hard to understand what you mean.
Initial view/dismiss initial view should be triggered based on 1) existence (if you user already logged in) and 2) validity of the token (if token is still valid) which is a variable so they are not exclusive.

1 Like

Hi @Dimos_Vamvourellis, using an app variable to control visibilities for different users is a possible alternative for the initial view, it just requires more work and testing from your side to make sure that the logic for changing the variable’s value is sound and there are no loopholes for unauthenticated users to access content that is only meant for logged in users.

1 Like

Thank you so much for the confirmation, i managed to use initial view combined with variables to make the app in the way as explained above, where most of the things dont need authentication, but in order to access the pages for example profile and checkout, you need to authenticate. My problem was that i didnt want to have to authenticate the user from the beginning, instead authenticate them when they need to use certain features.