Hi,
Thank you for your response, so the attached code was from my Application Service,
I am using the [AllowAnonymous] attribute, so everything works when I connect to the repositories that I have created, but the permission error occurs the moment I attempt to connect to the ABP Identity related Application Service, I have since tried using the IdentityManager instead and that seems to have bypassed the permissions issue, but I still need to use the ABP Identity Application Service to create the user account programmatically or even sign the user in automatically.
Do you have perhaps any pointers for me?
Exception message and full stack trace:
Exception of type 'Volo.Abp.Authorization.AbpAuthorizationException' was thrown.
at Microsoft.AspNetCore.Authorization.AbpAuthorizationServiceExtensions.d__16.MoveNext() at Volo.Abp.Authorization.MethodInvocationAuthorizationService.d__3.MoveNext() at Volo.Abp.Authorization.AuthorizationInterceptor.d__3.MoveNext() at Volo.Abp.Authorization.AuthorizationInterceptor.d__2.MoveNext() at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.d__3
1.MoveNext() at Castle.DynamicProxy.AsyncInterceptorBase.d__141.MoveNext() at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue
1.d__7.MoveNext() at Volo.Abp.Auditing.AuditingInterceptor.d__4.MoveNext() at Volo.Abp.Auditing.AuditingInterceptor.d__2.MoveNext() at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.d__3
1.MoveNext() at Castle.DynamicProxy.AsyncInterceptorBase.d__141.MoveNext() at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue
1.d__7.MoveNext() at Volo.Abp.Validation.ValidationInterceptor.d__2.MoveNext() at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.d__3
1.MoveNext() at Castle.DynamicProxy.AsyncInterceptorBase.d__141.MoveNext() at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue
1.d__7.MoveNext() at Volo.Abp.Uow.UnitOfWorkInterceptor.d__2.MoveNext() at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.d__3
1.MoveNext() at EDOnlineT3.LearnworldsAPI.LearnworldsApiTriggerService.d__16.MoveNext() in C:\dev\EdOnlineT3\src\EDOnlineT3.Application\LearnworldsAPI\LearnworldsApiTriggerService.cs:line 257 at EDOnlineT3.Controllers.LearnworldsAPI.LearnworldControllerBase.d__5.MoveNext() in C:\dev\EdOnlineT3\src\EDOnlineT3.HttpApi\Controllers\LearnworldsAPI\LearnWorldController.cs:line 51
Steps to reproduce the issue: I am trying to connect to our app which is from Abp via a third-party webhook, the idea is when a user logs into their account via the third-party site, they need to be automatically logged in on our app, and if they are not registered on our app, then a user account needs to be created for them and automatically sign them in.
I am getting the above error when attempting to connect to the Abp related identity modules, I just want to know how can I achieve the above and prevent the error. Below is my method:
[AllowAnonymous]
public async Task<IActionResult> HandleWebhookAsync(LearnworldsWebhookPayload payload, string signature)
{
var school = await _learnworldsAPIRepository.FirstOrDefaultAsync(x => x.LMSEndPoint.Contains(payload.School.Url));
if (school == null)
{
_logger.LogWarning("School not found");
return new NotFoundObjectResult("School not found");
}
//if (!ValidateSignature(payload, signature, school.WebhookKey))
//{
// _logger.LogWarning("Invalid webhook signature");
// return new UnauthorizedResult();
//}
var user = await _userAppService.FindByEmailAsync(payload?.User?.Email);
await _identityOptions.SetAsync();
if (user == null)
{
var input = new IdentityUserCreateDto
{
SendConfirmationEmail = true,
UserName = payload?.User?.Username ?? payload?.User?.Email,
Email = payload?.User?.Email,
//Name = payload?.data?.user?.name,
//Surname = payload?.data?.user?.surname,
Password = GuidGenerator.Create().ToString(),
RoleNames = new string[] { "User" },
ShouldChangePasswordOnNextLogin = true,
IsActive = true,
EmailConfirmed = false
};
user = await _userAppService.CreateAsync(input);
await _learnworldsAPIRepository.UpdateTenantId(school.TeachCoreSchoolId, user.Id);
var identityUserNew = await _userManager.GetByIdAsync(user.Id);
await _userManager.AddToRoleAsync(identityUserNew, "User");
await SendConfirmationEmailAsync(user.Email, identityUserNew.PasswordHash);
}
var identityUser = await _userManager.GetByIdAsync(user.Id);
// Generate a token for the user
var token = await GenerateTokenAsync(user);
// Sign the user in
await SignInUserAsync(user, token);
return new OkObjectResult(user);
}
Thank you very much, I am going to give this a try and let you know, thank you for your time
Thank you for the clarification, so if I understand your comment correctly, I can add the above components to my project and I should be able to replicate what I would like to do?
Hello, thank you for your response,
So I think we misunderstanding each other,
I want to inject my footerComponent into the above sidebar,
Can you perhaps just give me a direction to look for the sidebar or to customize this? I do not want to lose the sidebar which is pre-configured
Hello there,
Thank you for the above, I have used the replaceableComponent for the footer, but I want to move the footer to the <abp-sidebar>
Also I want to hide the <abp-sidebar> if a user is not authenticated, and then display it when a user logs in successfully
Hello, I hope you are doing well
I need some assistance or direction on a few things in regards to the LeptonX theme.
Is this possible on LeptonX Commercial?
We are currently using the commercial ABP Angular project.
Thank you
The document mentioned during the meeting: https://abp.io/docs/latest/framework/architecture/multi-tenancy#change-the-current-tenant
Thank you very much for your time Berkan,
I appreciate it, I will keep you posted on the progress, take care
Thank you so much, I am joining now
Hello,
If it is appropriate, you can send your sample application to support@abp.io with a text like below:
Please forward my mail to Berkan Sasmaz regarding ticket #8789.
Hi Berkan,
Uhm so I have quite a few dependent components which would cause errors, is that fine still?
I would prefer if we could have a call via Zoom or Microsoft teams so that I can take you through everything where the error points are.