Blazor server
I am running microservice on docker with a bridge network. Using HttpContextAccessor.HttpContext.Connection.RemoteIpAddress.ToString(), and it return the bridge gateway.
How to get the correct client ip address?
In the OnGetExternalLoginCallbackAsync function (login.html.cs), I found that calling signin two times there if the the signin result is not success but without signout. May I know the reason?
var result = await SignInManager.ExternalLoginSignInAsync(
loginInfo.LoginProvider,
loginInfo.ProviderKey,
isPersistent: true,
bypassTwoFactor: true
);
if (!result.Succeeded)
{
await IdentitySecurityLogManager.SaveAsync(new IdentitySecurityLogContext
{
Identity = IdentitySecurityLogIdentityConsts.IdentityExternal,
Action = "Login" + result
});
}
After added login info or created external user, it call signin method again.
var externalUser = await UserManager.FindByEmailAsync(email);
if (externalUser == null)
{
externalUser = await CreateExternalUserAsync(loginInfo);
}
else
{
if (await UserManager.FindByLoginAsync(loginInfo.LoginProvider, loginInfo.ProviderKey) == null)
{
CheckIdentityErrors(await UserManager.AddLoginAsync(externalUser, loginInfo));
}
}
if (await HasRequiredIdentitySettings())
{
Logger.LogWarning($"New external user is created but confirmation is required!");
await StoreConfirmUser(externalUser);
return RedirectToPage("./ConfirmUser", new {
returnUrl = ReturnUrl,
returnUrlHash = ReturnUrlHash
});
}
await SignInManager.SignInAsync(externalUser, false);
For the First login, I found that the result from ExternalLoginSignInAsync is not success. Can I add the signout there? Will it cause any problems?
if (!result.Succeeded)
{
await IdentitySecurityLogManager.SaveAsync(new IdentitySecurityLogContext
{
Identity = IdentitySecurityLogIdentityConsts.IdentityExternal,
Action = "Login" + result
});
await SignInManager.SignOutAsync();
}
deployed
Already increased the request size. Still not work.
Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.
If you're creating a bug/problem report, please include followings:
If login success, the cookies will be like that.
If the problem show up, cookies will be
If you want keep producing the issue, you can delete the record in AbpUserLogins table and login again.
It only occur when running on IIS. If using dotnet run in localhost, no such issue occur.
Thanks. It works now.
Checked. No record in the Redis.
It works now. Thank you.
Can you call the sample endpoint on gateway from the URL: https://localhost:44325/api/notification-service/sample ?
Can
If so, try adding the [Route] attribute to GetAsync method in SampleController:
Added. And throw the same exception.