title: How to add multiple users in LoginFlow - Xamarin system
body: <p>I have sample xamarin forms solution. I wanted username and login functionality. I was doing some research and found nice example. </p>
  
  <p><a href="https://developer.xamarin.com/samples/xamarin-forms/Navigation/LoginFlow/" rel="nofollow noreferrer">https://developer.xamarin.com/samples/xamarin-forms/Navigation/LoginFlow/</a></p>
  
  <p>I like the way 'LoginFlow' works. </p>
  
  <p>I want to hardcode the user accounts into solution and than when it comes to login user would just use their credentials which I will hard code and give them out individually. </p>
  
  <p>I can see there is file called "LoginNavigation->Constants.cs". It has one user account. </p>
  
  <p>My Question is how I can add multiple users in this so multiple user can login into this solution. </p>
  
  <pre><code>namespace LoginNavigation
   {
     public static class Constants
       {
          public static string Username = "Xamarin";
          public static string Password = "password";
  
  
         }
    }
  </code></pre>
  
  <p><strong>Edit</strong></p>
  
  <p>Getting error when matching credentials with login form to directory. </p>
  
  <p><strong>Constants.cs</strong></p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  
  namespace LoginNavigation
  {
      public class Constants
      {
          Dictionary&lt;string, string&gt; Credentials = new Dictionary&lt;string, string&gt;()
      {
          { "user1", "pass" },
          { "user2", "pass" },
          { "user3", "pass" }
      };
  
      }
  
  
  }
  </code></pre>
  
  <p>On the login page; This is action when user click login.</p>
  
  <p><strong>LoginPage.cs</strong></p>
  
  <pre><code>        async void OnLoginButtonClicked (object sender, EventArgs e)
           {
              var user = new User {
              Username = usernameEntry.Text,
              Password = passwordEntry.Text
          };
  
          var isValid = AreCredentialsCorrect (user);
          if (isValid) {
              App.IsUserLoggedIn = true;
              //Navigation.InsertPageBefore (new MainPageCS (), this);
              Navigation.InsertPageBefore(new MainPageCS(), Navigation.NavigationStack.First());
              await Navigation.PopAsync ();
          } else {
              messageLabel.Text = "Login failed";
              passwordEntry.Text = string.Empty;
          }
      }
  
  
      bool AreCredentialsCorrect (string user, string pass)
      {
          //return user.Username == Constants.Username &amp;&amp; user.Password == Constants.Password;
          return (Credentials.ContainsKey(user) &amp;&amp; Credentials[user] == pass);
  
      }
  </code></pre>
  
  <p>How I can fix above please. Thank you</p>