For my Xamarin.Forms app, I am looking for a way to check if a user has the right role/authentication status to access a page. I know Angular has route guards that can be reused for different routes to check for an authentication status. Is there something similar in Xamarin.Forms?
How can you restrict/control the navigation routes the user can visit based on login status/role?
3.7k Views Asked by Kevin van Schaijk At
1
There are 1 best solutions below
Related Questions in C#
- Passing arguments to main in C using Eclipse
- kernel module does not print packet info
- error C2016 (C requires that a struct or union has at least one member) and structs typedefs
- Drawing with ncurses, sockets and fork
- How to catch delay-import dll errors (missing dll or symbol) in MinGW(-w64)?
- Configured TTL for A record(s) backing CNAME records
- Allocating memory for pointers inside structures in functions
- Finding articulation point of undirected graph by DFS
- C first fgets() is being skipped while the second runs
- C std library don't appear to be linked in object file
- gcc static library compilation
- How to do a case-insensitive string comparison?
- C programming: Create and write 2D array of files as function
- How to read a file then store to array and then print?
- Function timeouts in C and thread
Related Questions in XAML
- WPF multiple control property simultaneous changes
- Telerik's WPF RadColorPicker NoColorText property not working
- Ellipsis inside button content Windows Phone
- Binding to "this.property" object in VisualStateMenager
- Scroll view mistakes
- ContextMenu Closes Immediately
- Update ObservableCollection where the items are received from another List
- Looping "complex" object with ItemsControl
- Animation Trigger (Storyboard + Trigger) in C#
- Exporting Datatable
- xaml c# chart with custom axis label
- Xamarin Forms - Show Cancel button in toolbar items instead of Back (iOS)
- Can custom text be added to a listview cell?
- Bind control property from the inner control
- WPF Interactions CallMethodAction for DataTemplate in ListCheckBox thrown a exception "Could not find method on object of type"
Related Questions in XAMARIN
- Xamarin Table View Crash
- How to read a characteristic (e.g. in WICED Smart example "speed_test")
- Using Azure MobileServices library with my own LAN WebApi
- Bundle Multiple Xamarin apps in one pkg installer
- Xamarin Google Cloud Messaging GcmClient.CheckDevice(this) causes runtime error
- UIAlertView popup won't let me swipe up Control Center
- How do I Insert a Previously Created SQLite Database into a Xamarin.Android App?
- Can custom text be added to a listview cell?
- How to run a ASP.net project to Xamarin Studio
- How can i do a fill animation in Xamarin.Forms
- How to change Display Alert default focus on a button?
- Mixing a CocosSharp game with UIViewControllers
- Building C# code in VSCode on Mac
- How to use research Kit framework in Xamarin
- Why is my app requesting permissions I didn't ask for?
Related Questions in XAMARIN.FORMS
- I need a event for the slider it should fire only if user ends touching the control
- Xamarin Forms - Show Cancel button in toolbar items instead of Back (iOS)
- How can i do a fill animation in Xamarin.Forms
- Visual Studio 2013 crashes when writing opening angle bracket
- How to change Display Alert default focus on a button?
- How to use research Kit framework in Xamarin
- xamarin.forms.labs ImageButton issue
- Can I generate an appx with a windows phone project?
- How Can I Change Height in ViewCell
- Xamarin Android Crash on Start "Got a SIGSEGV"
- When does Xamarin Forms trigger binding?
- Xamarin.forms : How to show the downstate of button which is having background image
- Xamarin.Forms Maps crashing app
- How to hide out a layout in Xamarin.forms C#?
- ListView Header and Footer not appearing
Related Questions in XAMARIN.FORMS.SHELL
- Reset xamarin.forms.shell to initial page on back button
- Append a control above/upper to the Shell App bar without altering it
- Xamarin.Forms Shell Navigation Hierarchy with parameters
- Xamarin Forms Flyout menu at bottom
- Correct place to register shell page routing?
- Bug? System.ArgumentException: 'unable to figure out route for:
- How to switch pages in the Xamarin Shell without a back button?
- How to define different items in Flyout menu and bottom tabbar in Xamarin Forms 4.8 version using Shell?
- Xamarin.Forms.Shell: how to manage StatusBar color
- Navigate to a specific top tab page in Xamarin Shell
- How can you restrict/control the navigation routes the user can visit based on login status/role?
- xamarin.forms shell tabbar is very slow
- How can I customize the appearance of top tabs (ShellSection) in Xamarin Shell?
- Shell TabBar rounded corners override default background color (View) behind
- Global routes currently cannot be the only page on the stack
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Here is an example showing how you can control the visibility or navigation to your pages based on the login status of the user.
By default Shell will always displays initially the first element defined in
AppShell.xaml, in this case it will beLogin.xamlpage.In the below example "Page3" will be visible initially because by default (
Isvisible=true), while "Page2" it will only be visible when the bindable propertyIsLoggedistrue.You can handle any logic when user Log in/Log out in the
IsLogged_PropertyChanged()event.If you want several/specific or page based roles you can always create/define/design yours, use them in bindings, raise and use their property changed event to execute actions.
With FlyoutItem
AppShell.xaml
AppShell.xaml.cs
Login.xaml
Login.xaml.cs
Same thing with Tabs
In this example "Symbols" bottom tab won't be visible the same for upper tab "B" that belongs to bottom tab "Letters" until the user log-in, the remaining bottoms tabs will be visible initially.
AppShell.xaml
Edit
You may also want to add
Shell.NavBarIsVisible="False"andShell.TabBarIsVisible="false"in the Tabbar case, to the LoginPage to respectively hide the navigation bar and hide the bottom tab bar.