Fix claims.

Use OID instead of email for microsoft identifier.
Fix PlayerCount route.
Add created date to user table.
Create spectator icon.
This commit is contained in:
2023-01-20 20:48:38 -06:00
parent 1d0beaf69f
commit 26fd955aa4
35 changed files with 672 additions and 1426 deletions

View File

@@ -1,5 +1,6 @@
using Shogi.Contracts.Api;
using Shogi.Contracts.Types;
using Shogi.UI.Pages.Home.Account;
using System.Net;
namespace Shogi.UI.Pages.Home.Api;
@@ -8,7 +9,7 @@ public interface IShogiApi
{
Task<Session?> GetSession(string name);
Task<ReadSessionsPlayerCountResponse?> GetSessionsPlayerCount();
Task<CreateTokenResponse?> GetToken();
Task<CreateTokenResponse?> GetToken(WhichAccountPlatform whichAccountPlatform);
Task GuestLogout();
Task Move(string sessionName, MovePieceCommand move);
Task<HttpStatusCode> PostSession(string name, bool isPrivate);

View File

@@ -57,10 +57,12 @@ namespace Shogi.UI.Pages.Home.Api
return null;
}
public async Task<CreateTokenResponse?> GetToken()
public async Task<CreateTokenResponse?> GetToken(WhichAccountPlatform whichAccountPlatform)
{
Console.WriteLine($"GetToken() - {accountState.User?.WhichAccountPlatform}");
var response = await HttpClient.GetFromJsonAsync<CreateTokenResponse>(new Uri("User/Token", UriKind.Relative), serializerOptions);
var httpClient = whichAccountPlatform == WhichAccountPlatform.Microsoft
? clientFactory.CreateClient(MsalClientName)
: clientFactory.CreateClient(GuestClientName);
var response = await httpClient.GetFromJsonAsync<CreateTokenResponse>(new Uri("User/Token", UriKind.Relative), serializerOptions);
return response;
}