Skip to content
This repository has been archived by the owner on Feb 23, 2025. It is now read-only.

Commit

Permalink
update client
Browse files Browse the repository at this point in the history
  • Loading branch information
leastprivilege committed Jul 19, 2022
1 parent 197aa8d commit e57354d
Showing 1 changed file with 3 additions and 25 deletions.
28 changes: 3 additions & 25 deletions clients/ConsoleClientWithBrowser/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace ConsoleClientWithBrowser
{
public class Program
{
static string _authority = "https://demo.duendesoftware.com";
static string _api = "https://demo.duendesoftware.com/api/test";

static OidcClient _oidcClient;
Expand All @@ -38,8 +37,8 @@ private static async Task SignIn()

var options = new OidcClientOptions
{
Authority = _authority,
ClientId = "interactive.public",
Authority = "https://demo.duendesoftware.com",
ClientId = "interactive.public.short",
RedirectUri = redirectUri,
Scope = "openid profile api offline_access",
FilterClaims = false,
Expand Down Expand Up @@ -94,12 +93,8 @@ private static void ShowResult(LoginResult result)

private static async Task NextSteps(LoginResult result)
{
var currentAccessToken = result.AccessToken;
var currentRefreshToken = result.RefreshToken;

var menu = " x...exit c...call api ";
if (currentRefreshToken != null) menu += "r...refresh token ";


while (true)
{
Console.WriteLine("\n\n");
Expand All @@ -109,23 +104,6 @@ private static async Task NextSteps(LoginResult result)

if (key.Key == ConsoleKey.X) return;
if (key.Key == ConsoleKey.C) await CallApi();
if (key.Key == ConsoleKey.R)
{
var refreshResult = await _oidcClient.RefreshTokenAsync(currentRefreshToken);
if (refreshResult.IsError)
{
Console.WriteLine($"Error: {refreshResult.Error}");
}
else
{
currentRefreshToken = refreshResult.RefreshToken;
currentAccessToken = refreshResult.AccessToken;

Console.WriteLine("\n\n");
Console.WriteLine($"access token: {currentAccessToken}");
Console.WriteLine($"refresh token: {currentRefreshToken ?? "none"}");
}
}
}
}

Expand Down

0 comments on commit e57354d

Please sign in to comment.