Windows.Security.Credentials.PasswordVault.Add C# (CSharp) Method

Add() public method

public Add ( [ credential ) : void
credential [
return void
		public extern void Add([In] PasswordCredential credential);
		public extern void Remove([In] PasswordCredential credential);

Usage Example

        //Use your consumerKey and ConsumerSecret


        private async void ButtonBase_OnClick(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(pinText.Text))
            {
                var msgDialog = new MessageDialog("Please Enter the pin showed below");
                await msgDialog.ShowAsync();
            }
            else
            {
                var pinCode = pinText.Text.Trim();
                var userCredentials = AuthFlow.CreateCredentialsFromVerifierCode(pinCode, authenticationContext);
                Auth.SetCredentials(userCredentials);

                var vault = new PasswordVault();
                vault.Add(new PasswordCredential("Friend", "TwitterAccessToken", userCredentials.AccessToken));
                vault.Add(new PasswordCredential("Friend", "TwitterAccessTokenSecret", userCredentials.AccessTokenSecret));
                var localSettings = ApplicationData.Current.LocalSettings;
                var frame = Window.Current.Content as Frame;

                if (localSettings.Values.ContainsKey("FirstTimeRunComplete"))
                {
                    frame?.Navigate(typeof(MainPage));
                }
                else
                {
                    frame?.Navigate(typeof(FirstTimeTutorial));
                }
            }
        }
All Usage Examples Of Windows.Security.Credentials.PasswordVault::Add