/// <summary> /// Request Account Access /// /// Manual process: /// You have to go manually to the bankURL, authenticate there and grant the permission to access the account(s) /// The bank will then redirect you, you must copy the query string and put it back in the application to continue /// /// FlowId: /// In this particular case, Crelan ask for a fixed FlowId /// Most of the time, you need to provide a unique identifier /// </summary> static async Task RequestAccountsAccessAsync(IBankingConnector bankConnector) { // Initialize account access request BankingResult <string> bankingResult = await bankConnector.RequestAccountsAccessAsync(new AccountsAccessRequest { FlowId = "STATE", //Guid.NewGuid().ToString() FrequencyPerDay = 2, RedirectUrl = RedirectURL, }); if (bankingResult.GetStatus() == ResultStatus.REDIRECT) { // FlowContext must be reused FlowContext flowContext = bankingResult.GetFlowContext(); // Ask the user to manually go to the redirect URL and enter the result string bankURL = bankingResult.GetData(); Console.WriteLine($"URL: {bankURL}"); Console.Write("Enter code: "); string queryString = Console.ReadLine(); Console.Write(flowContext); // Finalize authentication BankingResult <IUserContext> result = await bankConnector.RequestAccountsAccessFinalizeAsync(flowContext, queryString); if (result.GetStatus() == ResultStatus.DONE) { Console.WriteLine("RequestAccountsAccess succeeded"); return; } } throw new Exception("RequestAccountsAccess failed"); }