How to make Auto-Login for your Xamarin.Forms Mobile App.




The idea is to allow to the user to auto-login after his first verified connection.

(Here you find the simple project)

First of all you install this nuget package :

Install-Package AutoLogin.Mabrouk -Version 1.1.2

Now, let's code :)

In your App.xaml.cs (like here),  class that represents the cross-platform mobile application, you write your test, if user's infos are already saved than you get directly the main page and the login page will be ignored :



Than, in your connection's button event, you save your users info (Email, Password) like :



Other thing, if you want to delete user's infos you, for exemple in DISCONNECT button, you add simply this line of code : CrossAutoLogin.Current.DeleteUserInfos(); like :




Source code is available on GitHub.
I hope this tutorial was helpful for you and that this will be nice part of your new App.

Best regards from Tegernheim ! :)  Mabrouk Mahdhi

1 commentaires

  1. Hi,when i install nuget Package AutoLogin.Mabrouk -Version 1.1.2,
    i have this error,can you help me?

    Severity Code Description Project File Line Suppression State Error Can not resolve reference: Plugin.AutoLogin.Abstractions, referenced by MobileKPI. Please add a NuGet package or assembly reference for Plugin.AutoLogin.Abstractions, or remove the reference to MobileKPI. MobileKPI.Android

    RépondreSupprimer

My Instagram