From a76e5fd574a527ced0f0567922924df6b09bdc09 Mon Sep 17 00:00:00 2001 From: "Seonkyu.kim" Date: Thu, 29 May 2025 17:51:54 +0900 Subject: [PATCH] =?UTF-8?q?[=E2=9C=A8]=20=EC=B9=B4=EC=B9=B4=EC=98=A4=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EB=B2=84=ED=8A=BC=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Program/Views/Project/Auth.razor.cs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Program/Views/Project/Auth.razor.cs b/Program/Views/Project/Auth.razor.cs index a5a579b..b773cbe 100644 --- a/Program/Views/Project/Auth.razor.cs +++ b/Program/Views/Project/Auth.razor.cs @@ -1,3 +1,5 @@ +using System.Net.Http.Json; +using System.Text.Json; using Front.Program.Services; using Microsoft.AspNetCore.Components; using Microsoft.JSInterop; @@ -7,23 +9,21 @@ namespace Front.Program.Views.Project; public partial class Auth : ComponentBase { [Inject] NavigationManager NavigationManager { get; set; } = default!; - [Inject] IJSRuntime JS { get; set; } = default!; - [Inject] CookieService Cookie {get; set;} = default!; - + // [Inject] IJSRuntime JS { get; set; } = default!; + // [Inject] CookieService Cookie { get; set; } = default!; + [Inject] HttpClient Http { get; set; } = default!; + public async Task KakaoLogin() { - var headerKey = "Web_AM_Connect_Key"; - // var headerValue = await JS.InvokeAsync("eval", "document.cookie.match(/Web_AM_Connect_Key=([^;]+)/)?.[1] || ''"); + var url = "/api/v1/out/user/kakao/auth"; + var response = await Http.GetFromJsonAsync(url); + var kakaoUrl = response.GetProperty("url").GetString(); + + Console.WriteLine(kakaoUrl); - // NavigationManager.NavigateTo("/api/v1/in/user/kakao/auth", true); - Cookie.GetCookieAsync(headerKey).ContinueWith(async task => + if (!string.IsNullOrEmpty(kakaoUrl)) { - var cookie = task.Result; - if (!string.IsNullOrEmpty(cookie)) - { - await JS.InvokeVoidAsync("postWithHeader", "/api/v1/in/user/kakao/auth", "GET", headerKey, cookie); - - } - }); + NavigationManager.NavigateTo(kakaoUrl, true); // 카카오 인증 페이지로 이동 + } } } \ No newline at end of file