public TwitterUserApiSettings GetTwitterUserApiSettings() { var expectedUserSettingPath = TwittootLocation.GetUserFilePath(UserSettingsFileName); if (File.Exists(expectedUserSettingPath)) { var fileContent = File.ReadAllText(expectedUserSettingPath); var userSettings = JsonConvert.DeserializeObject <TwitterUserApiSettings>(fileContent); return(userSettings); } else { var pinAuthenticator = new PinAuthenticator(GetTwitterDevApiSettings()); var creds = pinAuthenticator.GetTwitterCredentials(); var userSettings = new TwitterUserApiSettings { AccessToken = creds.AccessToken, AccessTokenSecret = creds.AccessTokenSecret }; var json = JsonConvert.SerializeObject(userSettings); File.WriteAllText(expectedUserSettingPath, json); return(userSettings); } }
public void GetCredentials() { var settings = GetSettings.GetDevSettings(); var pinAuthenticator = new PinAuthenticator(settings); var creds = pinAuthenticator.GetTwitterCredentials(); }