Clean up LoginWithGoogle.cs

This commit is contained in:
2025-01-07 03:13:18 -05:00
parent 9c728d10c4
commit c0b3773b16

View File

@@ -1,6 +1,5 @@
using System.Text.Json; using System.Text.Json;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using Hutopy.Web.Common;
using Hutopy.Web.Common.Security; using Hutopy.Web.Common.Security;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
@@ -32,6 +31,7 @@ public class GoogleUserInfo
public record LoginWithGoogleRequest( public record LoginWithGoogleRequest(
string Token); string Token);
[PublicAPI]
public record LoginWithGoogleResponse( public record LoginWithGoogleResponse(
string AccessToken, string AccessToken,
string RefreshToken); string RefreshToken);
@@ -59,7 +59,7 @@ public class LoginWithGoogleHandler(
// Verify the token with Google // Verify the token with Google
using var httpClient = httpClientFactory.CreateClient(); using var httpClient = httpClientFactory.CreateClient();
var response = await httpClient.GetAsync( using var response = await httpClient.GetAsync(
$"https://www.googleapis.com/oauth2/v1/userinfo?access_token={googleToken.AccessToken}", $"https://www.googleapis.com/oauth2/v1/userinfo?access_token={googleToken.AccessToken}",
ct); ct);
if (!response.IsSuccessStatusCode) if (!response.IsSuccessStatusCode)