Activities of "yunusemrecaglar"

Answer

2024-09-02 08:54:32.857 +03:00 [INF] Request starting HTTP/2 GET https://mykgsapi.erciyes.edu.tr/hangfire - - 2024-09-02 08:54:32.873 +03:00 [INF] Request finished HTTP/2 GET https://mykgsapi.erciyes.edu.tr/hangfire - - - 401 - - 16.1820ms

It gives an error this way.

private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration)
{
context.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
  .AddJwtBearer(options =>
  {
      options.Authority = configuration["AuthServer:Authority"];
      options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]);
      options.Audience = "Obiyosis";
  });
}
2024-08-30 21:57:25.942 +03:00 [INF] Bearer was not authenticated. Failure message: IDX10206: Unable to validate audience. The 'audiences' parameter is empty.
2024-08-30 21:57:25.944 +03:00 [INF] Executing endpoint 'Obiyosis.Controllers.MobileUsers.MobileUserController.GetListAsync (Obiyosis.HttpApi)'
2024-08-30 21:57:25.944 +03:00 [INF] Route matched with {area = "app", controller = "MobileUser", action = "GetList", page = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[Volo.Abp.Application.Dtos.PagedResultDto`1[Obiyosis.MobileUsers.MobileUserDto]] GetListAsync(Obiyosis.MobileUsers.GetMobileUsersInput) on controller Obiyosis.Controllers.MobileUsers.MobileUserController (Obiyosis.HttpApi).
2024-08-30 21:57:25.948 +03:00 [INF] Authorization failed. These requirements were not met:
PermissionRequirement: Obiyosis.MobileUsers
2024-08-30 21:57:25.960 +03:00 [WRN] ---------- RemoteServiceErrorInfo ----------
{
  "code": "Volo.Authorization:010001",
  "message": "Authorization failed! Given policy has not granted.",
  "details": null,
  "data": {},
  "validationErrors": null
}

2024-08-30 21:57:25.960 +03:00 [WRN] Exception of type 'Volo.Abp.Authorization.AbpAuthorizationException' was thrown.
Volo.Abp.Authorization.AbpAuthorizationException: Exception of type 'Volo.Abp.Authorization.AbpAuthorizationException' was thrown.
   at Microsoft.AspNetCore.Authorization.AbpAuthorizationServiceExtensions.CheckAsync(IAuthorizationService authorizationService, AuthorizationPolicy policy)
   at Volo.Abp.Authorization.MethodInvocationAuthorizationService.CheckAsync(MethodInvocationAuthorizationContext context)
   at Volo.Abp.Authorization.AuthorizationInterceptor.AuthorizeAsync(IAbpMethodInvocation invocation)
   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 lambda_method3279(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.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
   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-30 21:57:25.960 +03:00 [WRN] Code:Volo.Authorization:010001
Answer

2024-08-30 17:28:50.312 +03:00 [INF] Request starting HTTP/2 GET https://mykgsapi.erciyes.edu.tr/hangfire - - 2024-08-30 17:28:50.335 +03:00 [ERR] An exception was thrown while deserializing the token. Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException: The antiforgery token could not be decrypted. ---> System.Security.Cryptography.CryptographicException: The key {***} was not found in the key ring. For more information go to http://aka.ms/dataprotectionwarning at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.UnprotectCore(Byte[] protectedData, Boolean allowOperationsOnRevokedKeys, UnprotectStatus& status) at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Unprotect(Byte[] protectedData) at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgeryTokenSerializer.Deserialize(String serializedToken) --- End of inner exception stack trace --- at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgeryTokenSerializer.Deserialize(String serializedToken) at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgery.GetCookieTokenDoesNotThrow(HttpContext httpContext) 2024-08-30 17:28:50.347 +03:00 [INF] Request finished HTTP/2 GET https://mykgsapi.erciyes.edu.tr/hangfire - - - 401 - - 35.4183ms 2024-08-30 17:28:50.943 +03:00 [INF] Executing ObjectResult, writing value of type 'System.String'. 2024-08-30 17:28:50.949 +03:00 [INF] Executed action MYKGS.Controllers.Terminals.TerminalController.GetStatus (MYKGS.HttpApi) in 901.7395ms 2024-08-30 17:28:50.949 +03:00 [INF] Executed endpoint 'MYKGS.Controllers.Terminals.TerminalController.GetStatus (MYKGS.HttpApi)' 2024-08-30 17:28:50.950 +03:00 [INF] Request finished HTTP/1.1 GET http://mykgsapi.erciyes.edu.tr/api/app/terminals/get-status?DATAS=RO9+kO+aSF5cpHUCFoH12UfChW8cHedRkFYPm7/VkcNn00z6kt22gMIrwobM1de8e4unSckmpswBQQVdCWEKPrQg3lSqdvTX7bmn3PUwin70nWp5sU/rw5cvtIxpDYaQ14Y2qResiujfFfVZhyxaPsJwkV7A+KiMlZ3Ysbx6JgUK6u6pH9jWGOcpKAT1tuT8 application/json - - 200 - text/plain;+charset=utf-8 1650.9087ms 2024-08-30 17:28:51.422 +03:00 [INF] Executed endpoint 'Health checks' 2024-08-30 17:28:51.426 +03:00 [INF] Request finished HTTP/1.1 GET https://mykgsapi.erciyes.edu.tr/health-status - - - 200 - application/json 2046.5687ms 2024-08-30 17:28:51.429 +03:00 [INF] Received HTTP response headers after 2114.8712ms - 200 2024-08-30 17:28:51.430 +03:00 [INF] End processing HTTP request after 2125.8605ms - 200

  • ABP Framework version: v7.2.2
  • UI Type: Blazor Server
  • Database System: EF Core (SQL Server, Oracle, MySQL, PostgreSQL, etc..)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes

I get a 401 error when making a request to the API with a token. What should I do?

Answer

401 error code

Answer

It worked locally, but I'm still getting a 401 error on the server.

Answer

I couldn't resolve it. I'm still getting a 401 error. Is it possible to redirect to the login screen immediately after accessing Hangfire if a 401 error occurs, and then return to Hangfire afterwards?

Answer
app.UseConfiguredEndpoints(endpoints =>
 {
     endpoints.MapControllers();
     endpoints.MapHub<TerminalHub>("/terminal-hub", options =>
     {
         options.LongPolling.PollTimeout = TimeSpan.FromSeconds(30);
     });
 });

This code is also in my code, I added it as you mentioned, but it's still the same.

Answer
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
    var app = context.GetApplicationBuilder();
    var env = context.GetEnvironment();
    app.UseResponseCompression();

    if (env.IsDevelopment())
    {
        app.UseDeveloperExceptionPage();
    }

    app.UseAbpRequestLocalization();
    app.UseStaticFiles();
    app.UseAbpSecurityHeaders();
    app.UseRouting();
    app.UseCors();
    app.UseAuthentication();

    if (MultiTenancyConsts.IsEnabled)
    {
        app.UseMultiTenancy();
    }

    app.UseAuthorization();
    app.UseSwagger();
    app.UseAbpSwaggerUI(options =>
    {
        options.SwaggerEndpoint("/swagger/v1/swagger.json", "MYKGS API");

        var configuration = context.GetConfiguration();
        options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]);
    });
    app.UseAuditing();
    app.UseAbpSerilogEnrichers();
    app.UseUnitOfWork();
    app.UseConfiguredEndpoints(endpoints =>
    {
        endpoints.MapControllers();
        endpoints.MapHub&lt;TerminalHub&gt;("/terminal-hub", options =>
        {
            options.LongPolling.PollTimeout = TimeSpan.FromSeconds(30);
        });
    });
    app.UseHangfireDashboard("/hangfire", new DashboardOptions
    {
        AsyncAuthorization = new[] { new AbpHangfireAuthorizationFilter(false) }
    });
    //app.UseHangfireDashboard("/hangfire");
    RecurringJobs.ManageResignedAndExpiredJobs();
}
Answer

Even though I've logged in, I'm still getting a 401 error in the dashboard section.

Showing 11 to 20 of 82 entries
Made with ❤️ on ABP v9.1.0-preview. Updated on November 01, 2024, 05:35