AHHHHH https://github.com/aspnetzero/aspnet-zero-core/commit/75a802fc92b80c04666e071a2d40a46c70299614
I seee :)
I've done some more debugging here.
It would appear that
var principal = _tokenHandler.ValidateToken(securityToken, validationParameters, out var validatedToken);
On line 43 in the ValidateToken method of teh AsyncJwtSecurityTokenHandler only returns a principal with claims of a token_type of 1.
When you get to line 45 in the HasAccessTokenType which checks for a token_type of 0 (being the access token) its not there and the exception is thrown and the refresh token is never allowed to be valid then.
Trying to find where this broke as I'm pretty sure it used to work.
@here Could we get a response on this one please. Here is some more data. I turned on debug logging for the tokenauthcontroller.
2022-08-04T10:07:24.529+10:00 - 9d95359ff29d - Abp.AspNetCore.Mvc.ExceptionHandling.AbpExceptionFilter - Refresh token is not valid! System.ComponentModel.DataAnnotations.ValidationException: Refresh token is not valid! at XXX.Web.Controllers.TokenAuthController.RefreshToken(String refreshToken) in D:\a\1\s\aspnet-core\src\XXX.Web.Core\Controllers\TokenAuthController.cs:line 376 at lambda_method15537(Closure , Object ) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(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.<InvokeNextActionFilterAsync>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>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
DEBUG2022-08-04T10:07:24.308+10:00 - 9d95359ff29d - XXX.Web.Controllers.TokenAuthController - Microsoft.IdentityModel.Tokens.SecurityTokenException: invalid token type at XXX.Web.Authentication.JwtBearer.XXXAsyncJwtSecurityTokenHandler.ValidateToken(String securityToken, TokenValidationParameters validationParameters) in D:\a\1\s\aspnet-core\src\XXX.Web.Core\Authentication\JwtBearer\XXXAsyncJwtSecurityTokenHandler.cs:line 76 at XXX.Web.Controllers.TokenAuthController.IsRefreshTokenValid(String refreshToken) in D:\a\1\s\aspnet-core\src\XXX.Web.Core\Controllers\TokenAuthController.cs:line 1011 Microsoft.IdentityModel.Tokens.SecurityTokenException: invalid token type at XXX.Web.Authentication.JwtBearer.XXXAsyncJwtSecurityTokenHandler.ValidateToken(String securityToken, TokenValidationParameters validationParameters) in D:\a\1\s\aspnet-core\src\XXX.Web.Core\Authentication\JwtBearer\XXXAsyncJwtSecurityTokenHandler.cs:line 76 at XXX.Web.Controllers.TokenAuthController.IsRefreshTokenValid(String refreshToken) in D:\a\1\s\aspnet-core\src\XXX.Web.Core\Controllers\TokenAuthController.cs:line 1011
Hi Daniela,
There are a number of existing tickets with the sub menu. Check these threads out
https://support.aspnetzero.com/QA/Questions/11143/Nested-Side-Menu-Doesn't-Track-Active-Menu-Item-When-2-Levels-Deep
https://support.aspnetzero.com/QA/Questions/10926/Side-bar-navigation---not-collapsing
Also check the github issues as there are fixes mentioned there. Not sure if they are your specific issue.
Rick
Tagging myself in this ticket as I'm seeing lots of these errors through my logs as well. Curious to see what the cause is. Don't believe I was seeing this in our logs when we were on version 10 so it looks to be something specific to v11.
Excellent update. I've added that into mine as well.
Thanks Outdoored.
Found them. For anyone else interested I've decifered it all :)
If you download Metronic 8 from your Aspnet Zero page you will find in the design folder Sketchy Pro SVG files.
Essentially it is this: https://keenthemes.com/products/sketchy-pro
The metronic team have taken those images and created the login page image which can be found in this folder metronic_v8.0.26\angular\docs\src\assets\media\illustrations\sketchy-1
As 14.png and 14-dark.png.
I'll now be attempting to change that :)
Thanks for the pointers outdoored.
Rick
You need to override the GetClientIpAddress in the HttpContextClientInfoProvider.
What I've done is have in the MyProject.Web.Core project in the Helpers folder I created my own class.
`using Abp.AspNetCore.Mvc.Auditing; using Microsoft.AspNetCore.Http; using System;
namespace MyProject.Web.Helpers { public class MyProjectHttpContextClientInfoProvider : HttpContextClientInfoProvider { private readonly IHttpContextAccessor _httpContextAccessor;
public MyProjectHttpContextClientInfoProvider(IHttpContextAccessor httpContextAccessor) : base(httpContextAccessor)
{
_httpContextAccessor = httpContextAccessor;
}
protected override string GetClientIpAddress()
{
try
{
var httpContext = _httpContextAccessor.HttpContext;
if (httpContext?.Request?.Headers?.ContainsKey("Cf-Connecting-IP") ?? false)
{
return httpContext.Request.Headers["Cf-Connecting-IP"];
}
else
{
return httpContext?.Connection?.RemoteIpAddress?.ToString();
}
}
catch (Exception ex)
{
Logger.Warn(ex.ToString());
}
return null;
}
}
} `
Then you need to tell the system to use your class.
In the MyProjectWebCoreModule.cs file in the same project.
Add this line at the end of PreInitialize
`Configuration.ReplaceService<IClientInfoProvider, MyProjectHttpContextClientInfoProvider>(DependencyLifeStyle.Transient);
I have found the problem. It is this line. https://github.com/aspnetzero/aspnet-zero-core/blob/577684256e8e1a4cf58c886f820f9061d42020d5/angular/src/app/shared/layout/nav/side-bar-menu.component.ts#L151
Changed it to this and it works fine.
if (!this.iconMenu && this.isMenuItemIsActive(item)) {
classes += ' show';
}
Removed the parentItem==null check as that was stopping it from adding the show class to a nested sub-menu.
Interesting. Ok I think you are correct after all with your first response.
Putting in a ToList does work. However in my full application it doesn't.
In my full application the ToList doesn't work. However I think there is a lot more complexity in my Linq to SQL in my application which is triggering the issue. In the simple application as shown above the ToList does work.
Very strange. Thankfully I've only used it in a few places so have managed to work around the issue. Thanks for pointing me to it.
Cheers