Open page at log in depending on user

Hi everyone, I would like to direct users to specific pages depending on who it is that logs in. I will have three different users and they will all need to see different things once logged in. Could anyone please point me in the right direction?

When you say different things you mean the page format will be the same but with different info for each one or you want completely different things to show up depending on the user?

Completely different things Dimos

So one simple way i would do is as bellow
This logic will be put in the sign in button

this is for the first if

and this for the second

the app variable could be the idtoken returned when signing in or the name or even a number returned from the users profile after sign in.

I dont know if there is a better way to do it, also i dont know how hackerproof this way is but if you dont care for safety so much is a great way.

I hope it helps you

Thank you so so much!

your welcome, I hope it solves your problem!

1 Like

Hi Dimos.

Did you test your solution with app preview. It seems, whenever you call dismiss view it opens the initial page set on navegariam tab, ignoring whatever open page flow function before. I had a similar problem and had to set the if conditions on the initial pages. Let me know if you testes and it worked. In that case I’m probably missing on something.

so to tell you the truth i didn’t try it in a page with auth enabled, only in one without authentication. and your way of thinking definitely makes cense one more problem in my solution was that i forgot to put the numbers in “” like bellow

On the other hand, as i said in my last answer, from what i understand, in order to have three users, there is a small possibility that you dont care about safety and privacy and that the app will not be distributed so, if this is the case you could not use auth and make like a custom in app authentication system, so you will not even need the dismiss view

Hey Alan, could you explain your solution, please? I’m suffering from the same problem and I’m at a bit of a roadblock

Hi Luke.

I defined a boolean app variable, first_time_user, with the default value set to false. The first thing I evaluate after the user signs in is whether or not it’s a first-time user. If true, I set the app variable first_time_user to true.

On the home page, the first flow function connected to the event, page mount, is an if condition with value bound to the variable first_time_user. If the condition evaluates to true, then it opens a specific page. If it evaluates to false, than the rest of the flow function for home page, get loaded. Reply this post if you still have questions.


Just now, I see it’s a diferent topic from my own. Sorry for that. The solution I posted may not work for you but it’s a start.

Could you explain what the role of these users are and how will they use the app differently from each other? Is there a role difference? For example, the manager is able to access such and such pages. The salesman such and such and so on. If you could please provide more details will be easier to help.

Hi there i have a question on your solution, how would you evaluate if someone is a first time user, in order to set the app variable? Maybe a Boolean in the backend? or there is a more elegant way.

Hi Alan, yes of course. I’m creating a review application for cleaning jobs that require three users. 1st is the admin, with the ability to add new users (clients and employees), upload and assign new jobs, and view reviews. The 2nd is cleaners, that can view upcoming jobs, view their own reviews and complete a checklist of tasks for each assigned job. And 3rd is the client, that can view their jobs and leave a review of the work that has taken place.
After a lot of struggle I think (correct me if I’m wrong), I’m best logging everyone into the same page, but have three custom nav footers depending on the user, each with navigation to pages unique to that navbar only - rather than opening different pages at log in.

Yes, I do think your solution will work.

However, here’s my way of accomplishing the task:

I would create only one navigation menu (that could be on the footer or on the right side - actually doesn’t matter), and on the visible property for the icon component, I would set a formula, so the component is visible only for the user which is allowed to access that specific page. For example, for the component holding the icon which gives access to page Upcoming Jobs I would set the formula for the visible property: IF(user_category=="cleaner"). That will ensure, each user will see a menu different from each other, although you have created only one menu.

The same is valid if you want to show the same page for all users, but hide some info from some users. Let’s say, for example, you want to allow the admin to delete/edit reviews, but not the cleaner. On the review page, you could add and edit/delete icon/button and hide it from the cleaners in the visible property for that component: IF(user_category=="admin").

The visible property for each component is under the advanced property. Clicking on the button marked on the screenshot below will pop out a window. Choose formula and then type the formula in.

There are lots of possibilities for accomplishing the task. If you think, the admin is a whole different app with so many functionalities that doesn’t make sense, using the solution described above you could even build a total new app for only the admin users but using the same database.

The way I set it first:

In the log in page, after the user is successfully logged in, I would retrieve the data for that user using the flow function get record. This flow function has two outputs. The first for the successful request and the second when the request fails. If the user is a first-time user, there’s no data attached to that user, and therefore the request will fail and second output would be triggered, vice versa. Then I would connect open page flow functions to the output of get record accordingly.

However, if you are using the auth functionality in appgyver, dismissing initial view will always (doesn’t matter what you do) open the home page.

So, my so solution is defining the variable first_time_user in the output of get record.

Alan, thank you a thousand times over for your help and explanation, you’ve helped me no end.

1 Like