Base solution for your next web application

Activities of "mika"

Now I took the refreshToken from mobile app, and with postman I was able to get new access token. But with that token, I got Unauthorized access with api call /api/services/app/User/GetUserForEdit?Id=5.

How tenancy is handled with apicalls?

I was hoping to get some detailed steps to determine what the problem is.

This problem started after mergin V7.x.x if i remember correctly and we have not customized any authentication codes.

I now tried to debug mobile app with our staging server at V7.2.2 and my other mobile device with V7.2.2. There is token refresh call in the UserConfigurationService.GetAuthenticatedUserConfig that is called on startup. After that, my main view starts and I try to load profile picture. That call fails and AuthenticationHttpHandler:s RefreshToken is called. After that I get "User not logged in".

The get profile picture call uses same token that was received with UserConfigurationService.RefreshAccessTokenAndSendRequestAgain at first time but it fails and new token is received from server. Then there is a loop to refresh token, try to get picture again, fail, refresh token......

So the refreshed token is not workin for some reason?

Here is apicall sequence after startup (AuthenticationHttpHandler.SendAsync):

  1. AbpUserConfiguration/GetAll
  2. RefreshToken
  3. AbpUserConfiguration/GetAll
  • Startup screen closes and my main view starts
  1. Profile/GetProfilePictureById
  2. RefreshToken
  3. Profile/GetProfilePictureById
  4. RefreshToken

=> "Error user not logged in"

Hi

It is quite bad experience if we update our server and every customers mobile app will crash before they update it!

And I just tested, yesterday I installed app (v7.2.2) to my tablet (no previous app version) and there is same "Customer not logged in error".

We get daily complaints about this error so it would be nice to have some quicker responce..

Hi all

Github issue created by someone else: Issue

@xugowebteam Thank you, I found the codes after pressing the ::before as you suggested. I changed the codes in vendors.bundle.css and it now works. I hope that there will be soon fixed file with all codes at the github.

@SASIMEXICO I searched with visual studio "flaticon2-" in all my angular files and figured out all the icons I needed to check for a quick fix.

Hi @ismcagdas

The mobile apps token is generated with V7.0.0 and when I updated server side to v7.2.2, the mobile app (still v.7.0.0) is not starting at all. The mobile apps token may be old or corrupted because of the initial problem, but updating server to v7.2.2 generated this new problem. Now I need to know how I can allow apps to connect new server without crashing.

@xugowebteam Could you explain bit more how did you re-map the classes? How did you get the right code?

For example I have flaticon2-trash:before{content:"\f186"}

So I updated our Staging to V7.2.2 and tried to connect my mobile which has v7.0.0 version still running, targeting to staging server. The app crashes immediately after start without any info.

I tested debugging and it connects to the server, where I see "Refresh token is not valid".

At mobile end I see "Internal Server Exception" and the crashing happens when app is trying to translate word "Error" without appContext.Configuration. The app is calling RefreshTokenAsync ( var response = await client.Request(RefreshTokenUrlSegment) .PostUrlEncodedAsync(new { refreshToken = AuthenticateResult.RefreshToken }) .ReceiveJson<AjaxResponse<RefreshTokenResult>>(); ) but the request is failing.

After that, app tries to produce translation for this. Exception is being thrown at L.cs when appContext.Configuration == null (throw new Exception("Set configuration before using remote localization!").

Here is log from server:

INFO  2019-09-21 07:18:22,349 [78   ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://ourstagingsite.net/AbpUserConfiguration/GetAll  
INFO  2019-09-21 07:18:22,351 [78   ] uthentication.JwtBearer.JwtBearerHandler - Failed to validate the token.
Microsoft.IdentityModel.Tokens.SecurityTokenExpiredException: IDX10223: Lifetime validation failed. The token is expired. ValidTo: "[PII is hidden]", Current time: "[PII is hidden]".
   at Microsoft.IdentityModel.Tokens.Validators.ValidateLifetime(Nullable"1 notBefore, Nullable"1 expires, SecurityToken securityToken, TokenValidationParameters validationParameters)
   at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateLifetime(Nullable"1 notBefore, Nullable"1 expires, JwtSecurityToken jwtToken, TokenValidationParameters validationParameters)
   at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateTokenPayload(JwtSecurityToken jwtToken, TokenValidationParameters validationParameters)
   at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateToken(String token, TokenValidationParameters validationParameters, SecurityToken& validatedToken)
   at Company.App.Web.Authentication.JwtBearer.AppicationJwtSecurityTokenHandler.ValidateToken(String securityToken, TokenValidationParameters validationParameters, SecurityToken& validatedToken) in C:\Projects\Appication\src\Company.App.Web.Core\Authentication\JwtBearer\AppicationJwtSecurityTokenHandler.cs:line 40
   at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()
   
   
INFO  2019-09-21 07:18:22,357 [78   ] uthentication.JwtBearer.JwtBearerHandler - Bearer was not authenticated. Failure message: IDX10223: Lifetime validation failed. The token is expired. ValidTo: "[PII is hidden]", Current time: "[PII is hidden]".
INFO  2019-09-21 07:18:22,358 [78   ] ft.AspNetCore.Routing.EndpointMiddleware - Executing endpoint "Abp.AspNetCore.Mvc.Controllers.AbpUserConfigurationController.GetAll (Abp.AspNetCore)"
INFO  2019-09-21 07:18:22,361 [78   ] ore.Mvc.Internal.ControllerActionInvoker - Route matched with {action = "GetAll", controller = "AbpUserConfiguration", area = ""}. Executing controller action with signature System.Threading.Tasks.Task"1[Microsoft.AspNetCore.Mvc.JsonResult] GetAll() on controller Abp.AspNetCore.Mvc.Controllers.AbpUserConfigurationController (Abp.AspNetCore).
INFO  2019-09-21 07:18:22,367 [78   ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method Abp.AspNetCore.Mvc.Controllers.AbpUserConfigurationController.GetAll (Abp.AspNetCore) - Validation state: Valid
INFO  2019-09-21 07:18:22,408 [78   ] ore.Mvc.Internal.ControllerActionInvoker - Executed action method Abp.AspNetCore.Mvc.Controllers.AbpUserConfigurationController.GetAll (Abp.AspNetCore), returned result Microsoft.AspNetCore.Mvc.JsonResult in 39.723ms.
INFO  2019-09-21 07:18:22,422 [78   ] matters.Json.Internal.JsonResultExecutor - Executing JsonResult, writing value of type "Abp.Web.Models.AjaxResponse".
INFO  2019-09-21 07:18:22,426 [78   ] ore.Mvc.Internal.ControllerActionInvoker - Executed action Abp.AspNetCore.Mvc.Controllers.AbpUserConfigurationController.GetAll (Abp.AspNetCore) in 63.4793ms
INFO  2019-09-21 07:18:22,427 [78   ] ft.AspNetCore.Routing.EndpointMiddleware - Executed endpoint "Abp.AspNetCore.Mvc.Controllers.AbpUserConfigurationController.GetAll (Abp.AspNetCore)"
INFO  2019-09-21 07:18:22,427 [78   ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 78.0453ms 200 application/json; charset=utf-8
INFO  2019-09-21 07:18:23,276 [78   ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 POST http://ourstagingsite.net/api/TokenAuth/RefreshToken application/x-www-form-urlencoded; charset=utf-8 866
INFO  2019-09-21 07:18:23,278 [78   ] ft.AspNetCore.Routing.EndpointMiddleware - Executing endpoint "Company.App.Web.Controllers.TokenAuthController.RefreshToken (Company.App.Web.Core)"
INFO  2019-09-21 07:18:23,281 [78   ] ore.Mvc.Internal.ControllerActionInvoker - Route matched with {action = "RefreshToken", controller = "TokenAuth", area = ""}. Executing controller action with signature System.Threading.Tasks.Task"1[Company.App.Authorization.Accounts.Dto.RefreshTokenResult] RefreshToken(System.String) on controller Company.App.Web.Controllers.TokenAuthController (Company.App.Web.Core).
INFO  2019-09-21 07:18:23,298 [78   ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method Company.App.Web.Controllers.TokenAuthController.RefreshToken (Company.App.Web.Core) - Validation state: Valid
ERROR 2019-09-21 07:18:23,313 [78   ] Mvc.ExceptionHandling.AbpExceptionFilter - Refresh token is not valid!
System.ComponentModel.DataAnnotations.ValidationException: Refresh token is not valid!
   at Company.App.Web.Controllers.TokenAuthController.RefreshToken(String refreshToken) in C:\Projects\Appication\src\Company.App.Web.Core\Controllers\TokenAuthController.cs:line 222
   at lambda_method(Closure , Object )
   at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()
   at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at System.Threading.Tasks.ValueTask"1.get_Result()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextExceptionFilterAsync()
   
   
INFO  2019-09-21 07:18:23,315 [78   ] .Mvc.Infrastructure.ObjectResultExecutor - Executing ObjectResult, writing value of type "Abp.Web.Models.AjaxResponse".
INFO  2019-09-21 07:18:23,315 [78   ] ore.Mvc.Internal.ControllerActionInvoker - Executed action Company.App.Web.Controllers.TokenAuthController.RefreshToken (Company.App.Web.Core) in 33.3464ms
INFO  2019-09-21 07:18:23,316 [78   ] ft.AspNetCore.Routing.EndpointMiddleware - Executed endpoint "Company.App.Web.Controllers.TokenAuthController.RefreshToken (Company.App.Web.Core)"
INFO  2019-09-21 07:18:23,317 [78   ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 40.3461ms 500 application/json; charset=utf-8

So this brings me two questions:

  1. Why this missing configuration can crash the whole app without any notice? Now user is not logged out or anything so the app broken. I know I have now kind of special case, but I am thinking ahead if someday there is going to be some other server inner exception and app is just crashing without any notice.

  2. There is some changes for v7.2.2 but I would like to have our old apps (< V7.2.2) still working at least somewhat as they were so this token expired => server inner exception is not good for me. How come before the app just started with saying "Current user is not logged in"? Shoult there be "Unauthorized exception" and not "Server Inner exception" when token refresh is not ok??

We have some issues with our iOS version, so we can't force our customers to update for v7.2.2 mobile apps, so I need to find a way to get server communicate with both old and newer versions.

I updated my Core+Angular project to V7.2.2 and now flaticons are wrong? Any adwise? For example I have flaticon2-trash being used but now the symbol looks like flaticon2-user-outline-symbol..

Can you provide more detail what kind of logs you need and where to look for errors beside the "CultureNotFoundException"

Hi

So v7.2.2 this problem might be resolved? I can try to merge these changes and test.

Showing 11 to 20 of 36 entries