Я хочу включить аутентификацию Google в своем веб-приложении (ASP. NET Core 3.1). Я получил эту ошибку:
URI перенаправления в запросе, https://localhost: 44345 / signin-google , не совпадает с авторизованным для клиента OAuth. Чтобы обновить авторизованные URI перенаправления, посетите: https://console.developers.google.com/apis/credentials/oauthclient/ ...
Как я могу решить эту проблему?
Я установил перенаправление Uri в моем console.developers.google.com, например:
Авторизовано JavaScript происхождение
URI:
https://localhost: 44345
URI авторизованного перенаправления
URI:
https://localhost: 44345 / Аккаунт / GoogleResponse
AccountController:
[Authorize]
public class AccountController : BaseController
{
[AllowAnonymous]
public IActionResult GoogleLogin(string returnUrl)
{
string redirectUrl = Url.Action("GoogleResponse", "Account", new { ReturnUrl = returnUrl });
var properties = signInManager
.ConfigureExternalAuthenticationProperties("Google", redirectUrl);
return new ChallengeResult("Google", properties);
}
[AllowAnonymous]
public async Task<IActionResult> GoogleResponse(string returnUrl = "/")
{
// some codes
}
}