public static void AuthorizeUsingRefreshToken(Dinero dinero, string clientId, string clientSecret) { //Calling authorize against the api var token = dinero.Authorize(); //Get refresh token var refreshtoken = token.RefreshToken; if (refreshtoken == null) { Console.WriteLine("You do not have permission to use access tokens."); return; } Console.WriteLine("Refreshtoken obtained."); //TODO: persist the refresh token in db for later use Console.WriteLine("Instantiate new Dinero object using refresh token."); var client = new ClientCredentials(clientId, clientSecret); //instantiate using refresh token var dinero2 = new Dinero(client, new RefreshToken(refreshtoken)); //Calling authorize against the api dinero2.Authorize(); Console.WriteLine("Authorization successfull."); }
private const string PathToSavePdfsTo = null; // <- Replace with path static int Main() { var client = new ClientCredentials(ClientId, ClientSecret); var apiKey = new ApiKey(ApiKey); var dinero = new Dinero(client, apiKey, OrganizationId); //Calling authorize against the api dinero.Authorize(); while (true) { PrintMenu(); var userChoice = GetInput(); if (userChoice.Equals("q", StringComparison.InvariantCultureIgnoreCase)) { return 0; } PerformAction(dinero, userChoice).ContinueWith(t => Pause()).Wait(); } }