Its more or less a test how well the helper services improve the implementation. I havent implemented anything fancy here atm. Just testing the oauth2 flow
25 lines
691 B
Plaintext
25 lines
691 B
Plaintext
@using MoonCore.Helpers
|
|
@using Moonlight.Shared.Http.Responses.Auth
|
|
|
|
@inject NavigationManager Navigation
|
|
@inject HttpApiClient HttpApiClient
|
|
|
|
<div class="flex justify-center">
|
|
<WButton OnClick="StartAuth" CssClasses="btn btn-primary">Authenticate</WButton>
|
|
</div>
|
|
|
|
@code
|
|
{
|
|
private async Task StartAuth(WButton _)
|
|
{
|
|
var authStartData = await HttpApiClient.GetJson<AuthStartResponse>("api/auth/start");
|
|
|
|
var uri = authStartData.Endpoint
|
|
+ $"?client_id={authStartData.ClientId}" +
|
|
$"&redirect_uri={authStartData.RedirectUri}" +
|
|
$"&response_type=code";
|
|
|
|
Navigation.NavigateTo(uri, true);
|
|
}
|
|
}
|