The idea is to allow the user to auto-login after his/her first verified connection. Here, you will find the simple project.
First of all, you need to install this NuGet Package. Or use this command in VS's Package Manager Console.
- Install-Package AutoLogin.Mabrouk -Version 1.1.2
In your App.xaml.cs (like here) class which represents the cross-platform mobile application, you write your test. If the user's information is already saved, then you get directly to the main page and the login page will be ignored,
- public App() {
- InitializeComponent();
- // If user is saved ; HomePage is opened
- if (CrossAutoLogin.Current.UserIsSaved) MainPage = new AutoLoginSimple.HomePage();
- else MainPage = new AutoLoginSimple.MainPage();
- }
- private void Connect_clicked(object sender, EventArgs e)
- {
- //Do something ...
- // Test if user is already saved
- if (CrossAutoLogin.Current.UserIsSaved == false)
- {
- CrossAutoLogin.Current.SaveUserInfos(entry_email.Text, entry_password.Text);
- }
- Navigation.PushModalAsync(new HomePage());
- }
Also, if you want to delete user's information, for exemple in DISCONNECT button, you can simply add this line of code -
Example
- private void Disconnect_clicked(object sender, EventArgs e)
- {
- CrossAutoLogin.Current.DeleteUserInfos();
- Navigation.PopModalAsync();
- }
Source code is available on GitHub.
I hope this tutorial was helpful for you.

Anthony DevillePosted Mar 8, 2020, 9:51 AM
Does not work
sathish kumarPosted Mar 1, 2020, 11:45 PM
Kindly update Latest Version.does not working in xamarin form 4.4
Raed RahmahPosted Nov 6, 2017, 3:42 AM
Thanks alot for you and your solution