From f65eda733c56eba492f3434fbcdd7f2757cef3eb Mon Sep 17 00:00:00 2001 From: Sergey Karmanov Date: Sun, 24 Dec 2023 05:27:32 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CyberBoom/Controllers/UserController.cs | 2 +- CyberBoom/Program.cs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CyberBoom/Controllers/UserController.cs b/CyberBoom/Controllers/UserController.cs index 771cd20..149d5d2 100644 --- a/CyberBoom/Controllers/UserController.cs +++ b/CyberBoom/Controllers/UserController.cs @@ -148,7 +148,7 @@ public class UsersController : ControllerBase [HttpGet("signin-google")] public IActionResult SignInWithGoogle() { - var properties = new AuthenticationProperties { RedirectUri = Url.Action("SignInWithGoogleCallback") }; + var properties = new AuthenticationProperties { RedirectUri = Url.Action(nameof(SignInWithGoogleCallback)) }; return Challenge(properties, GoogleDefaults.AuthenticationScheme); } diff --git a/CyberBoom/Program.cs b/CyberBoom/Program.cs index 2751d19..b4eb34e 100644 --- a/CyberBoom/Program.cs +++ b/CyberBoom/Program.cs @@ -8,6 +8,8 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc.Authorization; using Microsoft.OpenApi.Models; using Microsoft.AspNetCore.Authentication.Google; +using Microsoft.AspNetCore.Authentication.OAuth; +using Microsoft.AspNetCore.Authentication.Cookies; TypeAdapterConfig.NewConfig().Map(d => d.SpeackerImage, s => s.SpeackerImage.JoinFileNames()); @@ -45,9 +47,10 @@ builder.Services.AddAuthentication(opt => { }) .AddGoogle(options => { + options.CallbackPath = new PathString("/api/users/signin-google"); options.ClientId = builder.Configuration["Google:ClientId"]!; options.ClientSecret = builder.Configuration["Google:ClientSecret"]!; -});; +});