hi
The solution: https://abp.io/support/questions/9924/Angular---Error-occurs-for-well-knownappspecificcomchromedevtoolsjson-request-on-Windows#answer-3a1c8917-86dd-2131-9225-1204dac407f2
hi
Try to override the AuthorizeController and check the (request.HasPromptValue(OpenIddictConstants.PromptValues.Login) && request.GetParameter("bankid").HasValue)
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using OpenIddict.Abstractions;
using OpenIddict.Server.AspNetCore;
using Volo.Abp.DependencyInjection;
using Volo.Abp.OpenIddict.Controllers;
namespace BankIdDemo.BankId;
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(AuthorizeController))]
public class MyAuthorizeController : AuthorizeController
{
public override async Task<IActionResult> HandleAsync()
{
var request = await GetOpenIddictServerRequestAsync(HttpContext);
var result = await HttpContext.AuthenticateAsync(IdentityConstants.ApplicationScheme);
if (result is not { Succeeded: true } ||
((request.HasPromptValue(OpenIddictConstants.PromptValues.Login) || request.MaxAge is 0 ||
(request.MaxAge != null && result.Properties?.IssuedUtc != null &&
TimeProvider.System.GetUtcNow() - result.Properties.IssuedUtc > TimeSpan.FromSeconds(request.MaxAge.Value))) &&
TempData["IgnoreAuthenticationChallenge"] is null or false)
|| (request.HasPromptValue(OpenIddictConstants.PromptValues.Login) && request.GetParameter("bankid").HasValue))
{
// If the client application requested promptless authentication,
// return an error indicating that the user is not logged in.
if (request.HasPromptValue(OpenIddictConstants.PromptValues.None))
{
return Forbid(
authenticationSchemes: OpenIddictServerAspNetCoreDefaults.AuthenticationScheme,
properties: new AuthenticationProperties(new Dictionary<string, string>
{
[OpenIddictServerAspNetCoreConstants.Properties.Error] = OpenIddictConstants.Errors.LoginRequired,
[OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = "The user is not logged in."
}!));
}
TempData["IgnoreAuthenticationChallenge"] = true;
return Challenge(new AuthenticationProperties
{
RedirectUri = Request.PathBase + Request.Path + QueryString.Create(Request.HasFormContentType ? Request.Form : Request.Query)
});
}
return await base.HandleAsync();
}
}
hi
What is your UI type and abp&leptonx package version?
Thanks,
hi
It does not support this kind of structural solution.
I will create an internal issue to track your request.
Thanks.
Hi
I can confirm the problem is related to your database. It is not code problem.
Can you test your app with local db?
Thanks.
hi
Can you try this?
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Options;
using Volo.Abp;
using Volo.Abp.Account;
using Volo.Abp.Account.Emailing;
using Volo.Abp.Account.PhoneNumber;
using Volo.Abp.BlobStoring;
using Volo.Abp.Caching;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Identity;
using Volo.Abp.Imaging;
using Volo.Abp.SettingManagement;
namespace MyCompanyName.MyProjectName;
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(AccountAppService), typeof(IAccountAppService))]
public class MyAccountAppService : AccountAppService
{
protected IIdentityUserRepository IdentityUserRepository { get; set; }
public MyAccountAppService(
IdentityUserManager userManager,
IAccountEmailer accountEmailer,
IAccountPhoneService phoneService,
IIdentityRoleRepository roleRepository,
IdentitySecurityLogManager identitySecurityLogManager,
IBlobContainer<AccountProfilePictureContainer> accountProfilePictureContainer,
ISettingManager settingManager,
IOptions<IdentityOptions> identityOptions,
IIdentitySecurityLogRepository securityLogRepository,
IImageCompressor imageCompressor,
IOptions<AbpProfilePictureOptions> profilePictureOptions,
IApplicationInfoAccessor applicationInfoAccessor,
IdentityUserTwoFactorChecker identityUserTwoFactorChecker,
IDistributedCache<EmailConfirmationCodeCacheItem> emailConfirmationCodeCache,
IdentityErrorDescriber identityErrorDescriber,
IOptions<AbpRegisterEmailConfirmationCodeOptions> registerEmailConfirmationCodeOptions,
IIdentityUserRepository identityUserRepository)
: base(userManager, accountEmailer, phoneService, roleRepository, identitySecurityLogManager,
accountProfilePictureContainer, settingManager, identityOptions, securityLogRepository, imageCompressor,
profilePictureOptions, applicationInfoAccessor, identityUserTwoFactorChecker, emailConfirmationCodeCache,
identityErrorDescriber, registerEmailConfirmationCodeOptions)
{
IdentityUserRepository = identityUserRepository;
}
public override async Task<bool> VerifyPasswordResetTokenAsync(VerifyPasswordResetTokenInput input)
{
var user = await IdentityUserRepository.GetAsync(input.UserId, includeDetails: false);
return await UserManager.VerifyUserTokenAsync(
user,
UserManager.Options.Tokens.PasswordResetTokenProvider,
UserManager<IdentityUser>.ResetPasswordTokenPurpose,
input.ResetToken);
}
public override async Task ResetPasswordAsync(ResetPasswordDto input)
{
await IdentityOptions.SetAsync();
var user = await IdentityUserRepository.GetAsync(input.UserId, includeDetails: false);
(await UserManager.ResetPasswordAsync(user, input.ResetToken, input.Password)).CheckErrors();
await IdentitySecurityLogManager.SaveAsync(new IdentitySecurityLogContext
{
Identity = IdentitySecurityLogIdentityConsts.Identity,
Action = IdentitySecurityLogActionConsts.ChangePassword
});
}
}
hi Sandy
Our Angular team will provide a solution here soon.
Thanks.
ok, I will check the video and try again.
ok, I will share a new version code snippet
Thanks.