none
Microsoft Authentification RRS feed

  • Question

  • I'm using Xamarin Forms I have two method to authenticate user :

    1 : the user enter username and password

    2 : the user can authenticate with their Office 365 account .

    for the first method when the user enter his username and password and check if username and password existe ... 
    i do this :

    var app = Application.Current as App;
    app.Properties["logged"] = "true";

    when closing the app and open it

    protected override void OnStart()
     {
    // Handle when your app starts
    Console.WriteLine("OnStart Method logged 1--> "+Application.Current.Properties.ContainsKey("logged"));
    Console.WriteLine("OnStart Method logged 2--> " + this.Properties["logged"].ToString());
    } 

    Console : 

    OnStart Method logged 1--> True
    OnStart Method logged 2--> true


    same thing for Office but i always go back to the Authentification Page and Application.Current.Properties.ContainsKey("logged"). is false 

    var app = Application.Current as App;
    app.Properties["logged"] = "true";


    Console : 

    OnStart Method logged 1--> False

    App.cs 

    App.cs
    
            if (this.Properties.ContainsKey("logged") && this.Properties["logged"].ToString() == "true")
            {
                MainPage = new NavigationPage(new MasterMenuPage());
            }
            else
            {
                if (this.Properties.ContainsKey("currentConfig"))
                {
                    MainPage = new NavigationPage(new AuthentificationPage());
                }
                else
                {
                    MainPage = new NavigationPage(new ChoixEcole());
                }
            }

    it's the same logic buy i can not understand why a lose information when i login with office account.   Is it related to token. 

    Thank you.

    Wednesday, April 10, 2019 10:22 AM

All replies