Open Closed

How to register user externally from postman #7703


User avatar
0
Shloklabs created
  • ABP Framework version: ABP CLI 8.2.1
  • UI Type: MVC
  • Database System:PostgreSQL
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • { "error": { "code": null, "message": "An internal error occurred during your request!", "details": null, "data": {}, "validationErrors": null } }
  • Steps to reproduce the issue: when i try to call the /api/account/register with the body mentioned error is thrown

9 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Please share full logs from backend.

    Thanks.

  • User Avatar
    0
    Shloklabs created

    these are my audit logs

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Please share the logs in logs.txt

  • User Avatar
    0
    Shloklabs created
    2024-08-13 14:43:42.842 +05:30 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessRequestContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ResolveRequestUri.
    2024-08-13 14:43:42.895 +05:30 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ResolveRequestUri.
    2024-08-13 14:43:42.906 +05:30 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.OpenIddictServerHandlers+InferEndpointType.
    2024-08-13 14:43:42.908 +05:30 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by Volo.Abp.Account.Web.Pages.Account.OpenIddictImpersonateInferEndpointType.
    2024-08-13 14:43:42.910 +05:30 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ValidateHostHeader.
    2024-08-13 14:43:43.133 +05:30 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ValidateHostHeader.
    2024-08-13 14:43:43.139 +05:30 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+EvaluateValidatedTokens.
    2024-08-13 14:43:43.142 +05:30 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ExtractAccessTokenFromAuthorizationHeader.
    2024-08-13 14:43:43.144 +05:30 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ExtractAccessTokenFromBodyForm.
    2024-08-13 14:43:43.252 +05:30 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ExtractAccessTokenFromQueryString.
    2024-08-13 14:43:43.253 +05:30 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+ValidateRequiredTokens.
    2024-08-13 14:43:43.253 +05:30 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was marked as rejected by OpenIddict.Validation.OpenIddictValidationHandlers+ValidateRequiredTokens.
    2024-08-13 14:43:43.253 +05:30 [DBG] AuthenticationScheme: OpenIddict.Validation.AspNetCore was not authenticated.
    2024-08-13 14:43:43.371 +05:30 [INF] Executing endpoint 'Volo.Abp.Account.AccountController.RegisterAsync (Volo.Abp.Account.Pro.Public.HttpApi)'
    2024-08-13 14:43:43.405 +05:30 [INF] Route matched with {area = "account", action = "Register", controller = "Account", page = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[Volo.Abp.Identity.IdentityUserDto] RegisterAsync(Volo.Abp.Account.RegisterDto) on controller Volo.Abp.Account.AccountController (Volo.Abp.Account.Pro.Public.HttpApi).
    2024-08-13 14:43:44.951 +05:30 [DBG] Added 0 entity changes to the current audit log
    2024-08-13 14:43:47.457 +05:30 [DBG] Added 0 entity changes to the current audit log
    2024-08-13 14:43:47.828 +05:30 [DBG] Added 0 entity changes to the current audit log
    2024-08-13 14:43:47.868 +05:30 [ERR] ---------- RemoteServiceErrorInfo ----------
    {
      "code": null,
      "message": "An internal error occurred during your request!",
      "details": null,
      "data": {},
      "validationErrors": null
    }
    
    2024-08-13 14:43:47.869 +05:30 [ERR] Url, named 'Abp.Account.EmailConfirmation', for the application 'saas_microservice' was not configured. Use AppUrlOptions to configure it!
    Volo.Abp.AbpException: Url, named 'Abp.Account.EmailConfirmation', for the application 'saas_microservice' was not configured. Use AppUrlOptions to configure it!
       at Volo.Abp.UI.Navigation.Urls.AppUrlProvider.GetConfiguredUrl(String appName, String urlName)
       at Volo.Abp.UI.Navigation.Urls.AppUrlProvider.GetUrlAsync(String appName, String urlName)
       at Volo.Abp.Account.Emailing.AccountEmailer.SendEmailConfirmationLinkAsync(IdentityUser user, String confirmationToken, String appName, String returnUrl, String returnUrlHash)
       at Volo.Abp.Account.AccountAppService.SendEmailConfirmationTokenAsync(IdentityUser user, String applicationName, String returnUrl, String returnUrlHash)
       at Volo.Abp.Account.AccountAppService.RegisterAsync(RegisterDto input)
       at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
       at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
       at Volo.Abp.Authorization.AuthorizationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
       at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
       at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
       at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
       at Volo.Abp.GlobalFeatures.GlobalFeatureInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
       at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
       at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
       at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
       at Volo.Abp.Auditing.AuditingInterceptor.ProceedByLoggingAsync(IAbpMethodInvocation invocation, AbpAuditingOptions options, IAuditingHelper auditingHelper, IAuditLogScope auditLogScope)
       at Volo.Abp.Auditing.AuditingInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
       at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
       at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
       at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
       at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
       at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
       at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
       at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
       at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
       at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
       at Volo.Abp.Account.AccountController.RegisterAsync(RegisterDto input)
       at lambda_method3968(Closure, Object)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.&lt;InvokeNextActionFilterAsync&gt;g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.&lt;InvokeInnerFilterAsync&gt;g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.&lt;InvokeNextExceptionFilterAsync&gt;g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
    2024-08-13 14:43:47.885 +05:30 [INF] Executing ObjectResult, writing value of type 'Volo.Abp.Http.RemoteServiceErrorResponse'.
    2024-08-13 14:43:47.910 +05:30 [INF] Executed action Volo.Abp.Account.AccountController.RegisterAsync (Volo.Abp.Account.Pro.Public.HttpApi) in 4499.892ms
    2024-08-13 14:43:47.914 +05:30 [INF] Executed endpoint 'Volo.Abp.Account.AccountController.RegisterAsync (Volo.Abp.Account.Pro.Public.HttpApi)'
    2024-08-13 14:43:48.999 +05:30 [DBG] Added 0 entity changes to the current audit log
    2024-08-13 14:43:49.015 +05:30 [DBG] Added 0 entity changes to the current audit log
    2024-08-13 14:43:49.030 +05:30 [INF] Request finished HTTP/1.1 POST https://localhost:5000/api/account/register - 500 null application/json; charset=utf-8 6946.9294ms
    2024-08-13 14:43:50.285 +05:30 [DBG] Executing HealthCheck collector HostedService.
    

    These are the recent logs

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    The error is:

    [ERR] Url, named 'Abp.Account.EmailConfirmation', for the application 'saas_microservice' was not configured. Use AppUrlOptions to configure it!
    
  • User Avatar
    0
    Shloklabs created
        Configure&lt;AppUrlOptions&gt;(options =>
        {
            options.Applications["MVC"].RootUrl = configuration["App:SelfUrl"];
            options.Applications["MVC"].Urls[AccountUrlNames.PasswordReset] = "account/reset-password";
            options.Applications["MVC"].Urls[AccountUrlNames.EmailConfirmation ] = "account/confirm-email";
        });
    

    I have updated the App Url options

    it is solved but now i have to send email confirmation how to handle that in registration flow

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    The register api will send the email confirmation automatically.

    Please check your logs. The default mail sender is NullEmailSender

    #if DEBUG
            context.Services.Replace(ServiceDescriptor.Singleton<IEmailSender, NullEmailSender>());
    #endif
    
  • User Avatar
    0
    Shloklabs created

    I resolved it by configuring the Email confirmation to my appsettings.josn , my actual case is how to register as a tenant

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    You can override this endpoint to add your code to create a tenant and create a user under this tenant.

    https://abp.io/docs/latest/framework/architecture/modularity/extending/customizing-application-modules-guide https://abp.io/docs/latest/framework/architecture/modularity/extending/customizing-application-modules-overriding-services

Made with ❤️ on ABP v9.1.0-preview. Updated on November 19, 2024, 12:56