I need some help with implementing of Google External Provider in MVC Core 5 : I just added Google External Provider in my project , and every thing works fine, but some things is wrong! here is what I do in my code , and the problem description:
startup.cs :
services.AddIdentity<User, Role>(config =>
{
config.User.RequireUniqueEmail = true;
config.Password.RequireDigit = true;
config.Password.RequireLowercase = true;
config.Password.RequireNonAlphanumeric = false;
config.Password.RequireUppercase = true;
config.Password.RequiredLength = 6;
config.Lockout.AllowedForNewUsers = true;
config.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromMinutes(5);
config.Lockout.MaxFailedAccessAttempts = 3;
})
.AddErrorDescriber<CustomIdentityErrorDescriber>()
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders();
services.AddAuthentication()
.AddGoogle("google", opt =>
{
var googleAuth = _config.GetSection("GoogleExternalSignIn");
opt.ClientId = googleAuth["ClientId"];
opt.ClientSecret = googleAuth["ClientSecret"];
opt.SignInScheme = IdentityConstants.ExternalScheme;
//opt.BackchannelTimeout = new TimeSpan(0, 5, 0);
})
;
with this implementation , after I going to login with google , google accounts page will open and I can chose to login with any account, but the problem is, that it works for every account just for the first time, after that whenever you wanna login with an account , It throw an exception like below :
System.Threading.CancellationToken.ThrowOperationCanceledException()
TimeoutException: The operation was canceled.
System.Threading.CancellationToken.ThrowOperationCanceledException()
TaskCanceledException: The request was canceled due to the configured HttpClient.Timeout of 300 seconds elapsing.
System.Net.Http.HttpClient.SendAsyncCore(HttpRequestMessage request, HttpCompletionOption completionOption, bool async, bool emitTelemetryStartStop, CancellationToken cancellationToken)
Exception: An error was encountered while handling the remote login.
I tried to set opt.BackchannelTimeout = new TimeSpan(0, 5, 0); in AddGoogle configuration , but after 5 minute taking to trying login, It returns above Exception.
How can I solve it ?
where is the problem ?