# Custom visibility of pages and callbacks based on logged in user

**URL:** <https://community.plotly.com/t/custom-visibility-of-pages-and-callbacks-based-on-logged-in-user/77620>\
**Category:** Dash Python\
**Created:** [August 9, 2023, 11:37pm UTC](https://community.plotly.com/t/custom-visibility-of-pages-and-callbacks-based-on-logged-in-user/77620 "2023-08-09T23:37:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![benn0](https://avatars.discourse-cdn.com/v4/letter/b/bb73d2/32.png) [@benn0](https://community.plotly.com/u/benn0)\
**Post date:** [August 9, 2023, 11:37pm UTC](https://community.plotly.com/t/custom-visibility-of-pages-and-callbacks-based-on-logged-in-user/77620/1 "2023-08-09T23:37:02Z")

</div>

Hi everyone,

I’m looking to incorporate some custom access controls on a dash application - namely, restricting particular pages and callbacks to logged in users with particular access levels. For the pages, at a high-level I am aiming to build the following:

- by default, pages are visible to anyone (a future feature would be to create default access control for all pages)
- for particular pages, evaluate a function based on the logged in user info to determine if this page is valid for that user
- if the page is not valid, this should function as if the page does not exist (i.e. return a 404)

I think I have a way forward using some custom multi-page code that I wrote prior to pages becoming a feature, but I would like to incorporate it into the current pages functionality, and was wondering if there was any broader appetite for this kind of functionality? Briefly looking at the pages code functionality, I think I can fork and implement something that works for me, but want to make it more useful if possible (and ideally done in such a way that I don’t have to maintain a fork).

---

<div class="post-metadata">

**Author:** ![jinnyzor](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/jinnyzor/32/21194_2.png) [@jinnyzor](https://community.plotly.com/u/jinnyzor)\
**Post date:** [August 9, 2023, 11:57pm UTC](https://community.plotly.com/t/custom-visibility-of-pages-and-callbacks-based-on-logged-in-user/77620/2 "2023-08-09T23:57:56Z")

</div>

Hello @benn0,

You should check out here:

> [@Dash App Pages with Flask Login Flow using Flask](https://community.plotly.com/t/dash-app-pages-with-flask-login-flow-using-flask/69507):
>
> Hello All! I’ve been working to be able to use the Flask method of logging in. This is an alteration of the flask\_login method provided here: [dash-multi-page-app-demos/multi\_page\_flask\_login at main · AnnMarieW/dash-multi-page-app-demos · GitHub](https://github.com/AnnMarieW/dash-multi-page-app-demos/tree/main/multi_page_flask_login) This will allow you to: restrict individual pages and redirect to login while saving the path (note: you will use the registered page name to restrict) once logged in, will redirect to the saved path or to the home page when logging out, it will redi…
