Skip to content

Commit 1786b60

Browse files
committed
fix: 오류 수정
1 parent 3627064 commit 1786b60

File tree

5 files changed

+434
-375
lines changed

5 files changed

+434
-375
lines changed

ProjectVG.Application/ApplicationServiceCollectionExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using ProjectVG.Application.Services.Auth;
33
using ProjectVG.Application.Services.Character;
44
using ProjectVG.Application.Services.Chat;
5+
using ProjectVG.Application.Services.Chat.CostTracking;
56
using ProjectVG.Application.Services.Conversation;
67
using ProjectVG.Application.Services.Session;
78
using ProjectVG.Application.Services.Users;
@@ -15,7 +16,7 @@ public static IServiceCollection AddApplicationServices(this IServiceCollection
1516
{
1617
// Auth Services
1718
services.AddScoped<IAuthService, AuthService>();
18-
services.AddScoped<IOAuth2Service, OAuth2Service>();
19+
services.AddSingleton<IOAuth2Service, OAuth2Service>();
1920
services.AddScoped<IOAuth2ProviderFactory, OAuth2ProviderFactory>();
2021

2122
// User Services
@@ -27,7 +28,6 @@ public static IServiceCollection AddApplicationServices(this IServiceCollection
2728
// Chat Services
2829
services.AddScoped<IChatService, ChatService>();
2930
services.AddScoped<IChatMetricsService, ChatMetricsService>();
30-
services.AddScoped<ICostTrackingDecoratorFactory, CostTrackingDecoratorFactory>();
3131

3232
// Conversation Services
3333
services.AddScoped<IConversationService, ConversationService>();

ProjectVG.Application/Services/Auth/OAuth2Service.cs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,17 +203,27 @@ public async Task<OAuth2UserInfo> GetUserInfoAsync(string accessToken, string pr
203203

204204
public async Task<OAuth2AuthRequest> StoreOAuth2RequestAsync(string state, OAuth2AuthRequest request)
205205
{
206-
_oauth2Requests[state] = JsonSerializer.Serialize(request);
207-
await Task.CompletedTask;
208-
return request;
206+
try
207+
{
208+
_oauth2Requests[state] = JsonSerializer.Serialize(request);
209+
await Task.CompletedTask;
210+
return request;
211+
}
212+
catch (Exception ex)
213+
{
214+
_logger.LogError(ex, "OAuth2 요청 저장 실패: State={State}", state);
215+
throw;
216+
}
209217
}
210218

211219
public async Task<OAuth2AuthRequest?> GetOAuth2RequestAsync(string state)
212-
{
220+
{
213221
if (_oauth2Requests.TryGetValue(state, out var json)) {
222+
var request = JsonSerializer.Deserialize<OAuth2AuthRequest>(json);
214223
await Task.CompletedTask;
215-
return JsonSerializer.Deserialize<OAuth2AuthRequest>(json);
224+
return request;
216225
}
226+
217227
await Task.CompletedTask;
218228
return null;
219229
}

ProjectVG.Application/Services/Chat/CostTracking/CostTrackingDecoratorFactory.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
using Microsoft.Extensions.DependencyInjection;
2-
using ProjectVG.Application.Models.Chat;
3-
using ProjectVG.Application.Services.Chat.CostTracking;
42

53
namespace ProjectVG.Application.Services.Chat.CostTracking
64
{

0 commit comments

Comments
 (0)