private static async Task <string> LaunchBrowserForTokenAsync() { var browser = new SystemBrowser(12345, "/native_client_callback"); var opts = new OidcClientOptions { Authority = authorityUrl, Scope = "openid movie_api", RedirectUri = "http://127.0.0.1:12345/native_client_callback", ClientId = "native_client", Browser = browser, }; // uncomment this line to enable logging //opts.LoggerFactory.AddConsole(LogLevel.Trace); var client = new OidcClient(opts); var result = await client.LoginAsync(); if (result.IsError) { Console.WriteLine($"Error: {result.Error}."); return(null); } return(result.AccessToken); }
private static async Task <string> LaunchBrowserForTokenAsync() { var browser = new SystemBrowser(12345, "/native_client_callback"); // TODO: setup the OidcClientOptions // TODO: create the OidcClient // TODO: call LoginAsync to get the result // TODO: if result is not Success then show the error info and return null from this method // TODO: return the access token (instead of null) return(null); }