Open Closed

Xamarin App after few hours of inactivity the user gets an error "Something went wrong" #9288


0
kansoftware created

Hi Support team,

In Xamarin App after few hours of inactivity the user gets an error "Something went wrong" and then we checked logs and find errors as below Please help fixing the issue asap:

System.Exception: There is no user: 111
   at Ksoft.Authorization.Users.UserManager.GetUserAsync(UserIdentifier userIdentifier)
   at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException[TResult](Task`1 task)
   at Nito.AsyncEx.AsyncContext.<>c__DisplayClass16_0`1.<Run>b__0(Task`1 t)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location where exception was thrown ---
   at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException[TResult](Task`1 task)
   at Nito.AsyncEx.AsyncContext.Run[TResult](Func`1 action)
   at Abp.Threading.AsyncHelper.RunSync[TResult](Func`1 func)
   at Ksoft.Authorization.Users.UserManager.GetUser(UserIdentifier userIdentifier)
   at Ksoft.Web.Authentication.JwtBearer.JwtSecurityStampHandler.ValidateSecurityStampFromDb(UserIdentifier userIdentifier, String securityStamp)
   at Ksoft.Web.Authentication.JwtBearer.JwtSecurityStampHandler.Validate(ClaimsPrincipal claimsPrincipal)
   at Ksoft.Web.Authentication.JwtBearer.KsoftJwtSecurityTokenHandler.ValidateSecurityStampAsync(ISettingManager settingManager, ClaimsPrincipal principal)
   at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException(Task task)
   at Nito.AsyncEx.AsyncContext.<>c__DisplayClass15_0.<Run>b__0(Task t)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location where exception was thrown ---
   at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException(Task task)
   at Nito.AsyncEx.AsyncContext.Run(Func`1 action)
   at Abp.Threading.AsyncHelper.RunSync(Func`1 action)
   at Ksoft.Web.Authentication.JwtBearer.KsoftJwtSecurityTokenHandler.ValidateToken(String securityToken, TokenValidationParameters validationParameters, SecurityToken& validatedToken)
   at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()
INFO  2020-07-01 06:58:38,671 [5    ] uthentication.JwtBearer.JwtBearerHandler - Bearer was not authenticated. Failure message: There is no user: 111
INFO  2020-07-01 06:58:38,672 [5    ] ft.AspNetCore.Routing.EndpointMiddleware - Executing endpoint 'Ksoft.Authorization.Users.UserAppService.GetUserForEdit (Ksoft.Application)'
INFO  2020-07-01 06:58:38,674 [5    ] c.Infrastructure.ControllerActionInvoker - Route matched with {area = "app", action = "GetUserForEdit", controller = "User"}. Executing controller action with signature System.Threading.Tasks.Task`1[Ksoft.Authorization.Users.Dto.GetUserForEditOutput] GetUserForEdit(Abp.Application.Services.Dto.NullableIdDto`1[System.Int64]) on controller Ksoft.Authorization.Users.UserAppService (Ksoft.Application).
WARN  2020-07-01 06:58:38,675 [5    ] Mvc.Authorization.AbpAuthorizationFilter - Abp.Authorization.AbpAuthorizationException: Current user did not login to the application!
   at Abp.Authorization.AuthorizationHelper.AuthorizeAsync(IEnumerable`1 authorizeAttributes)
   at Abp.Authorization.AuthorizationHelper.CheckPermissionsAsync(MethodInfo methodInfo, Type type)
   at Abp.Authorization.AuthorizationHelper.AuthorizeAsync(MethodInfo methodInfo, Type type)
   at Abp.AspNetCore.Mvc.Authorization.AbpAuthorizationFilter.OnAuthorizationAsync(AuthorizationFilterContext context)
Abp.Authorization.AbpAuthorizationException: Current user did not login to the application!
   at Abp.Authorization.AuthorizationHelper.AuthorizeAsync(IEnumerable`1 authorizeAttributes)
   at Abp.Authorization.AuthorizationHelper.CheckPermissionsAsync(MethodInfo methodInfo, Type type)
   at Abp.Authorization.AuthorizationHelper.AuthorizeAsync(MethodInfo methodInfo, Type type)
   at Abp.AspNetCore.Mvc.Authorization.AbpAuthorizationFilter.OnAuthorizationAsync(AuthorizationFilterContext context)
INFO  2020-07-01 06:58:38,675 [5    ] c.Infrastructure.ControllerActionInvoker - Authorization failed for the request at filter 'Abp.AspNetCore.Mvc.Authorization.AbpAuthorizationFilter'.
INFO  2020-07-01 06:58:38,675 [5    ] .Mvc.Infrastructure.ObjectResultExecutor - Executing ObjectResult, writing value of type 'Abp.Web.Models.AjaxResponse'.
INFO  2020-07-01 06:58:38,675 [5    ] c.Infrastructure.ControllerActionInvoker - Executed action Ksoft.Authorization.Users.UserAppService.GetUserForEdit (Ksoft.Application) in 1.2845ms
INFO  2020-07-01 06:58:38,675 [5    ] ft.AspNetCore.Routing.EndpointMiddleware - Executed endpoint 'Ksoft.Authorization.Users.UserAppService.GetUserForEdit (Ksoft.Application)'
INFO  2020-07-01 06:58:38,676 [5    ] Microsoft.AspNetCore.Hosting.Diagnostics - Request finished in 25.3751ms 401 application/json; charset=utf-8
INFO  2020-07-01 06:58:39,742 [5    ] Microsoft.AspNetCore.Hosting.Diagnostics - Request starting HTTP/1.1 POST https://services.equusconnect.com/api/TokenAuth/RefreshToken application/x-www-form-urlencoded; charset=utf-8 940
INFO  2020-07-01 06:58:39,742 [5    ] ft.AspNetCore.Routing.EndpointMiddleware - Executing endpoint 'Ksoft.Web.Controllers.TokenAuthController.RefreshToken (Ksoft.Web.Core)'
INFO  2020-07-01 06:58:39,745 [5    ] c.Infrastructure.ControllerActionInvoker - Route matched with {action = "RefreshToken", controller = "TokenAuth", area = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[Ksoft.Authorization.Accounts.Dto.RefreshTokenResult] RefreshToken(System.String) on controller Ksoft.Web.Controllers.TokenAuthController (Ksoft.Web.Core).
INFO  2020-07-01 06:58:39,785 [25   ] .Mvc.Infrastructure.ObjectResultExecutor - Executing ObjectResult, writing value of type 'Abp.Web.Models.AjaxResponse'.
INFO  2020-07-01 06:58:39,785 [25   ] c.Infrastructure.ControllerActionInvoker - Executed action Ksoft.Web.Controllers.TokenAuthController.RefreshToken (Ksoft.Web.Core) in 40.4151ms
INFO  2020-07-01 06:58:39,785 [25   ] ft.AspNetCore.Routing.EndpointMiddleware - Executed endpoint 'Ksoft.Web.Controllers.TokenAuthController.RefreshToken (Ksoft.Web.Core)'
INFO  2020-07-01 06:58:39,786 [25   ] Microsoft.AspNetCore.Hosting.Diagnostics - Request finished in 43.9552ms 200 application/json; charset=utf-8
INFO  2020-07-01 06:58:40,124 [25   ] Microsoft.AspNetCore.Hosting.Diagnostics - Request starting HTTP/1.1 GET https://services.equusconnect.com/api/services/app/User/GetUserForEdit?Id=111  
INFO  2020-07-01 06:58:40,484 [25   ] uthentication.JwtBearer.JwtBearerHandler - Failed to validate the token.
System.Exception: There is no user: 111
   at Ksoft.Authorization.Users.UserManager.GetUserAsync(UserIdentifier userIdentifier)
   at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException[TResult](Task`1 task)
   at Nito.AsyncEx.AsyncContext.<>c__DisplayClass16_0`1.<Run>b__0(Task`1 t)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location where exception was thrown ---
   at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException[TResult](Task`1 task)
   at Nito.AsyncEx.AsyncContext.Run[TResult](Func`1 action)
   at Abp.Threading.AsyncHelper.RunSync[TResult](Func`1 func)
   at Ksoft.Authorization.Users.UserManager.GetUser(UserIdentifier userIdentifier)
   at Ksoft.Web.Authentication.JwtBearer.JwtSecurityStampHandler.ValidateSecurityStampFromDb(UserIdentifier userIdentifier, String securityStamp)
   at Ksoft.Web.Authentication.JwtBearer.JwtSecurityStampHandler.Validate(ClaimsPrincipal claimsPrincipal)
   at Ksoft.Web.Authentication.JwtBearer.KsoftJwtSecurityTokenHandler.ValidateSecurityStampAsync(ISettingManager settingManager, ClaimsPrincipal principal)
   at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException(Task task)
   at Nito.AsyncEx.AsyncContext.<>c__DisplayClass15_0.<Run>b__0(Task t)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location where exception was thrown ---
   at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException(Task task)
   at Nito.AsyncEx.AsyncContext.Run(Func`1 action)
   at Abp.Threading.AsyncHelper.RunSync(Func`1 action)
   at Ksoft.Web.Authentication.JwtBearer.KsoftJwtSecurityTokenHandler.ValidateToken(String securityToken, TokenValidationParameters validationParameters, SecurityToken& validatedToken)
   at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()
INFO  2020-07-01 06:58:40,484 [25   ] uthentication.JwtBearer.JwtBearerHandler - Bearer was not authenticated. Failure message: There is no user: 111
INFO  2020-07-01 06:58:40,485 [25   ] ft.AspNetCore.Routing.EndpointMiddleware - Executing endpoint 'Ksoft.Authorization.Users.UserAppService.GetUserForEdit (Ksoft.Application)'
INFO  2020-07-01 06:58:40,487 [25   ] c.Infrastructure.ControllerActionInvoker - Route matched with {area = "app", action = "GetUserForEdit", controller = "User"}. Executing controller action with signature System.Threading.Tasks.Task`1[Ksoft.Authorization.Users.Dto.GetUserForEditOutput] GetUserForEdit(Abp.Application.Services.Dto.NullableIdDto`1[System.Int64]) on controller Ksoft.Authorization.Users.UserAppService (Ksoft.Application).
WARN  2020-07-01 06:58:40,488 [25   ] Mvc.Authorization.AbpAuthorizationFilter - Abp.Authorization.AbpAuthorizationException: Current user did not login to the application!
   at Abp.Authorization.AuthorizationHelper.AuthorizeAsync(IEnumerable`1 authorizeAttributes)
   at Abp.Authorization.AuthorizationHelper.CheckPermissionsAsync(MethodInfo methodInfo, Type type)
   at Abp.Authorization.AuthorizationHelper.AuthorizeAsync(MethodInfo methodInfo, Type type)
   at Abp.AspNetCore.Mvc.Authorization.AbpAuthorizationFilter.OnAuthorizationAsync(AuthorizationFilterContext context)
Abp.Authorization.AbpAuthorizationException: Current user did not login to the application!
   at Abp.Authorization.AuthorizationHelper.AuthorizeAsync(IEnumerable`1 authorizeAttributes)
   at Abp.Authorization.AuthorizationHelper.CheckPermissionsAsync(MethodInfo methodInfo, Type type)
   at Abp.Authorization.AuthorizationHelper.AuthorizeAsync(MethodInfo methodInfo, Type type)
   at Abp.AspNetCore.Mvc.Authorization.AbpAuthorizationFilter.OnAuthorizationAsync(AuthorizationFilterContext context)
INFO  2020-07-01 06:58:40,488 [25   ] c.Infrastructure.ControllerActionInvoker - Authorization failed for the request at filter 'Abp.AspNetCore.Mvc.Authorization.AbpAuthorizationFilter'.
INFO  2020-07-01 06:58:40,488 [25   ] .Mvc.Infrastructure.ObjectResultExecutor - Executing ObjectResult, writing value of type 'Abp.Web.Models.AjaxResponse'.
INFO  2020-07-01 06:58:40,489 [25   ] c.Infrastructure.ControllerActionInvoker - Executed action Ksoft.Authorization.Users.UserAppService.GetUserForEdit (Ksoft.Application) in 1.1956ms
INFO  2020-07-01 06:58:40,489 [25   ] ft.AspNetCore.Routing.EndpointMiddleware - Executed endpoint 'Ksoft.Authorization.Users.UserAppService.GetUserForEdit (Ksoft.Application)'
INFO  2020-07-01 06:58:40,489 [25   ] Microsoft.AspNetCore.Hosting.Diagnostics - Request finished in 364.6674ms 401 application/json; charset=utf-8
INFO  2020-07-01 06:58:40,751 [25   ] Microsoft.AspNetCore.Hosting.Diagnostics - Request starting HTTP/1.1 GET https://services.equusconnect.com/api/services/app/User/GetUserForEdit?Id=111  
INFO  2020-07-01 06:58:41,749 [25   ] uthentication.JwtBearer.JwtBearerHandler - Failed to validate the token.
System.Exception: There is no user: 111
   at Ksoft.Authorization.Users.UserManager.GetUserAsync(UserIdentifier userIdentifier)
   at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException[TResult](Task`1 task)
   at Nito.AsyncEx.AsyncContext.<>c__DisplayClass16_0`1.<Run>b__0(Task`1 t)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location where exception was thrown ---
   at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException[TResult](Task`1 task)
   at Nito.AsyncEx.AsyncContext.Run[TResult](Func`1 action)
   at Abp.Threading.AsyncHelper.RunSync[TResult](Func`1 func)
   at Ksoft.Authorization.Users.UserManager.GetUser(UserIdentifier userIdentifier)
   at Ksoft.Web.Authentication.JwtBearer.JwtSecurityStampHandler.ValidateSecurityStampFromDb(UserIdentifier userIdentifier, String securityStamp)
   at Ksoft.Web.Authentication.JwtBearer.JwtSecurityStampHandler.Validate(ClaimsPrincipal claimsPrincipal)
   at Ksoft.Web.Authentication.JwtBearer.KsoftJwtSecurityTokenHandler.ValidateSecurityStampAsync(ISettingManager settingManager, ClaimsPrincipal principal)
   at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException(Task task)
   at Nito.AsyncEx.AsyncContext.<>c__DisplayClass15_0.<Run>b__0(Task t)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location where exception was thrown ---
   at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException(Task task)
   at Nito.AsyncEx.AsyncContext.Run(Func`1 action)
   at Abp.Threading.AsyncHelper.RunSync(Func`1 action)
   at Ksoft.Web.Authentication.JwtBearer.KsoftJwtSecurityTokenHandler.ValidateToken(String securityToken, TokenValidationParameters validationParameters, SecurityToken& validatedToken)
   at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()
INFO  2020-07-01 06:58:41,749 [25   ] uthentication.JwtBearer.JwtBearerHandler - Bearer was not authenticated. Failure message: There is no user: 111

12 Answer(s)
  • 0
    ismcagdas created
    Support Team

    Hi @kansoftware

    Is this happening on Android or IOS ?

    Thanks,

  • 0
    kansoftware created

    On IOS.

    Thanks Harshit

  • 0
    alper created
    Support Team

    @kansoftware what's your token expire duration?

  • 0
    alper created
    Support Team

    is the logged in user, have 2 factor authentication?

  • 0
    alper created
    Support Team

    and the log says There is no user: 111 I think you are editing the user 111. Check that the user with the Id 111 exists in database. check that IsDeleted=0

  • 0
    kansoftware created

    what's your token expire duration? 24 Hours

    is the logged in user, have 2 factor authentication?
    No.

    and the log says " There is no user: 111". Is the logged in user's Id 111 or the entity that you are trying to edit is 111? Yes User is logged in and it exists

  • 0
    alper created
    Support Team

    I just remembered a bug that we have fixed earlier. There was a problem with the TenantId parameter while refreshing access token. This might be related to your issue. Can you check out this issue https://github.com/aspnetzero/aspnet-zero-core/issues/3056 ?

    to be able to go to the link you need to be an active ASP.NET Zero customer.

  • 0
    Jorahealth created

    HI @alper I am getting the same issue on Android application. On clicking above link I get a 404 error, could you please send me the issue link please.

  • 0
    alper created
    Support Team

    this has been fixed in 9.1.0 .

  • 0
    Jorahealth created

    @alper The above code seems to be already there in v8.9.2 (our current vesrion) are there any other dependenceis or codes that need changed. Do we need to migrate to v9.1 or just make changes in our current codes.

    Many Thanks in advance for your help

  • 0
    Jorahealth created

    @Alper I cannot get into this, I get 404 error...I have an active subscription with you.

  • 0
    alper created
    Support Team

    @Jorahealth, you can add your GitHub user to the AspNet Zero private GitHub repository. go to this link https://aspnetzero.com/LicenseManagement and add your GitHub username