Ends in:
6 DAYS
9 HRS
20 MIN
30 SEC
Ends in:
6 D
9 H
20 M
30 S
Open Closed

Unable to receive JWT to application API #8341


User avatar
0
Tony_Albutt created
  • ABP Framework version: v8.3.3
  • UI Type: MVC
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): no
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

Hi

I am unable to connect to my application API. I have 3 issues. 1 If I set the application method to [AllowAnonymous], I van use postman to get a token, and receive a response. When I debug the Application method, the system does not decode the Token, resulting in the CurrentUser = NULL I do decode the Tenant info. This may be some ware between ABP framework migration from V3 to 4 to 5 to 6 to 7 to 8.3.3

2 When I use the shell cmd : abp generate-proxy -t csharp -u https://localhost:44334/ my application breaks with the following error. System.StackOverflowException Looking for file /_/src/libraries/System.Private.CoreLib/src/System/Type.cs please select file. Exception message and full stack trace - added below

So I created a new test application and added one entity "ApiParameters". I then added a new copy of the module "Integration" into the application I added all the references and Dependencies. The new application has full access to the module can use all methods for all 12 entities. When I use the shell cmd : abp generate-proxy -t csharp -u https://localhost:44381/ only the "ApiParameters" proxies are added to the ClientProxies folder. This is the 3rd issue.

3 I am unable to generate client proxies for a module application "Integration", only the host "ApiParameters" proxy. Is there a missing parameter?

Please, are you able to assist?

Thanks and regards Tony


14 Answer(s)
  • User Avatar
    0
    Tony_Albutt created

    [09:43:29 INF] End processing HTTP request after 322.8505ms - 200 [09:43:29 INF] Received HTTP response headers after 17944.825ms - 200 [09:43:29 INF] End processing HTTP request after 17952.9452ms - 200 [09:43:39 INF] Skipping the execution of current filter as its not the most effective filter implementing the policy Microsoft.AspNetCore.Mvc.ViewFeatures.IAntiforgeryPolicy Stack overflow. at System.RuntimeTypeHandle.GetInstantiation(System.Runtime.CompilerServices.QCallTypeHandle, System.Runtime.CompilerServices.ObjectHandleOnStack, BOOL) at System.Type.get_GenericTypeArguments() at Volo.Abp.Reflection.TypeHelper.IsEnumerable(System.Type, System.Type ByRef, Boolean) at Volo.Abp.AspNetCore.Mvc.AspNetCoreApiDescriptionModelProvider.AddCustomTypesToModel(Volo.Abp.Http.Modeling.ApplicationApiDescriptionModel, System.Type) at Volo.Abp.AspNetCore.Mvc.AspNetCoreApiDescriptionModelProvider.AddCustomTypesToModel(Volo.Abp.Http.Modeling.ApplicationApiDescriptionModel, System.Type) at Volo.Abp.AspNetCore.Mvc.AspNetCoreApiDescriptionModelProvider.AddCustomTypesToModel(Volo.Abp.Http.Modeling.ApplicationApiDescriptionModel, System.Type) ...... ...... at Volo.Abp.AspNetCore.Mvc.AspNetCoreApiDescriptionModelProvider.AddCustomTypesToModel(Volo.Abp.Http.Modeling.ApplicationApiDescriptionModel, System.Type) at Volo.Abp.AspNetCore.Mvc.AspNetCoreApiDescriptionModelProvider.AddCustomTypesToModel(Volo.Abp.Http.Modeling.ApplicationApiDescriptionModel, System.Reflection.MethodInfo) at Volo.Abp.AspNetCore.Mvc.AspNetCoreApiDescriptionModelProvider.AddApiDescriptionToModel(Microsoft.AspNetCore.Mvc.ApiExplorer.ApiDescription, Volo.Abp.Http.Modeling.ApplicationApiDescriptionModel, Volo.Abp.Http.Modeling.ApplicationApiDescriptionModelRequestDto) at Volo.Abp.AspNetCore.Mvc.AspNetCoreApiDescriptionModelProvider.CreateApiModel(Volo.Abp.Http.Modeling.ApplicationApiDescriptionModelRequestDto) at Volo.Abp.AspNetCore.Mvc.ApiExploring.AbpApiDefinitionController.Get(Volo.Abp.Http.Modeling.ApplicationApiDescriptionModelRequestDto) at DynamicClass.lambda_method8454(System.Runtime.CompilerServices.Closure, System.Object, System.Object[]) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor+SyncObjectResultExecutor.Execute(Microsoft.AspNetCore.Mvc.ActionContext, Microsoft.AspNetCore.Mvc.Infrastructure.IActionResultTypeMapper, Microsoft.Extensions.Internal.ObjectMethodExecutor, System.Object, System.Object[]) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync() at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State ByRef, Scope ByRef, System.Object ByRef, Boolean ByRef) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync() at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAwaitedAsync() at Volo.Abp.AspNetCore.Mvc.Uow.AbpUowActionFilter+<OnActionExecutionAsync>d__0.MoveNext() at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Volo.Abp.AspNetCore.Mvc.Uow.AbpUowActionFilter+<OnActionExecutionAsync>d__0, Volo.Abp.AspNetCore.Mvc, Version=8.3.1.0, Culture=neutral, PublicKeyToken=null]](<OnActionExecutionAsync>d__0 ByRef) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[Volo.Abp.AspNetCore.Mvc.Uow.AbpUowActionFilter+<OnActionExecutionAsync>d__0, Volo.Abp.AspNetCore.Mvc, Version=8.3.1.0, Culture=neutral, PublicKeyToken=null]](<OnActionExecutionAsync>d__0 ByRef) at Volo.Abp.AspNetCore.Mvc.Uow.AbpUowActionFilter.OnActionExecutionAsync(Microsoft.AspNetCore.Mvc.Filters.ActionExecutingContext, Microsoft.AspNetCore.Mvc.Filters.ActionExecutionDelegate) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State ByRef, Scope ByRef, System.Object ByRef, Boolean ByRef) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync() at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAwaitedAsync() at Volo.Abp.AspNetCore.Mvc.Validation.AbpValidationActionFilter+<OnActionExecutionAsync>d__0.MoveNext() at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Volo.Abp.AspNetCore.Mvc.Validation.AbpValidationActionFilter+<OnActionExecutionAsync>d__0, Volo.Abp.AspNetCore.Mvc, Version=8.3.1.0, Culture=neutral, PublicKeyToken=null]](<OnActionExecutionAsync>d__0 ByRef) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[Volo.Abp.AspNetCore.Mvc.Validation.AbpValidationActionFilter+<OnActionExecutionAsync>d__0, Volo.Abp.AspNetCore.Mvc, Version=8.3.1.0, Culture=neutral, PublicKeyToken=null]](<OnActionExecutionAsync>d__0 ByRef) at Volo.Abp.AspNetCore.Mvc.Validation.AbpValidationActionFilter.OnActionExecutionAsync(Microsoft.AspNetCore.Mvc.Filters.ActionExecutingContext, Microsoft.AspNetCore.Mvc.Filters.ActionExecutionDelegate) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State ByRef, Scope ByRef, System.Object ByRef, Boolean ByRef) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync() at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAwaitedAsync() at Volo.Abp.AspNetCore.Mvc.Features.AbpFeatureActionFilter+<OnActionExecutionAsync>d__0.MoveNext() at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Volo.Abp.AspNetCore.Mvc.Features.AbpFeatureActionFilter+<OnActionExecutionAsync>d__0, Volo.Abp.AspNetCore.Mvc, Version=8.3.1.0, Culture=neutral, PublicKeyToken=null]](<OnActionExecutionAsync>d__0 ByRef) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[Volo.Abp.AspNetCore.Mvc.Features.AbpFeatureActionFilter+<OnActionExecutionAsync>d__0, Volo.Abp.AspNetCore.Mvc, Version=8.3.1.0, Culture=neutral, PublicKeyToken=null]](<OnActionExecutionAsync>d__0 ByRef) at Volo.Abp.AspNetCore.Mvc.Features.AbpFeatureActionFilter.OnActionExecutionAsync(Microsoft.AspNetCore.Mvc.Filters.ActionExecutingContext, Microsoft.AspNetCore.Mvc.Filters.ActionExecutionDelegate) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State ByRef, Scope ByRef, System.Object ByRef, Boolean ByRef) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync() at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAwaitedAsync() at Volo.Abp.AspNetCore.Mvc.Response.AbpNoContentActionFilter+<OnActionExecutionAsync>d__0.MoveNext() at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Volo.Abp.AspNetCore.Mvc.Response.AbpNoContentActionFilter+<OnActionExecutionAsync>d__0, Volo.Abp.AspNetCore.Mvc, Version=8.3.1.0, Culture=neutral, PublicKeyToken=null]](<OnActionExecutionAsync>d__0 ByRef) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[Volo.Abp.AspNetCore.Mvc.Response.AbpNoContentActionFilter+<OnActionExecutionAsync>d__0, Volo.Abp.AspNetCore.Mvc, Version=8.3.1.0, Culture=neutral, PublicKeyToken=null]](<OnActionExecutionAsync>d__0 ByRef) at Volo.Abp.AspNetCore.Mvc.Response.AbpNoContentActionFilter.OnActionExecutionAsync(Microsoft.AspNetCore.Mvc.Filters.ActionExecutingContext, Microsoft.AspNetCore.Mvc.Filters.ActionExecutionDelegate) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State ByRef, Scope ByRef, System.Object ByRef, Boolean ByRef) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync() at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAwaitedAsync() at Volo.Abp.AspNetCore.Mvc.Auditing.AbpAuditActionFilter+<OnActionExecutionAsync>d__0.MoveNext() at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Volo.Abp.AspNetCore.Mvc.Auditing.AbpAuditActionFilter+<OnActionExecutionAsync>d__0, Volo.Abp.AspNetCore.Mvc, Version=8.3.1.0, Culture=neutral, PublicKeyToken=null]](<OnActionExecutionAsync>d__0 ByRef) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[Volo.Abp.AspNetCore.Mvc.Auditing.AbpAuditActionFilter+<OnActionExecutionAsync>d__0, Volo.Abp.AspNetCore.Mvc, Version=8.3.1.0, Culture=neutral, PublicKeyToken=null]](<OnActionExecutionAsync>d__0 ByRef) at Volo.Abp.AspNetCore.Mvc.Auditing.AbpAuditActionFilter.OnActionExecutionAsync(Microsoft.AspNetCore.Mvc.Filters.ActionExecutingContext, Microsoft.AspNetCore.Mvc.Filters.ActionExecutionDelegate) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State ByRef, Scope ByRef, System.Object ByRef, Boolean ByRef) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync() at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAwaitedAsync() at Volo.Abp.AspNetCore.Mvc.GlobalFeatures.GlobalFeatureActionFilter+<OnActionExecutionAsync>d__0.MoveNext() at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Volo.Abp.AspNetCore.Mvc.GlobalFeatures.GlobalFeatureActionFilter+<OnActionExecutionAsync>d__0, Volo.Abp.AspNetCore.Mvc, Version=8.3.1.0, Culture=neutral, PublicKeyToken=null]](<OnActionExecutionAsync>d__0 ByRef) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[Volo.Abp.AspNetCore.Mvc.GlobalFeatures.GlobalFeatureActionFilter+<OnActionExecutionAsync>d__0, Volo.Abp.AspNetCore.Mvc, Version=8.3.1.0, Culture=neutral, PublicKeyToken=null]](<OnActionExecutionAsync>d__0 ByRef) at Volo.Abp.AspNetCore.Mvc.GlobalFeatures.GlobalFeatureActionFilter.OnActionExecutionAsync(Microsoft.AspNetCore.Mvc.Filters.ActionExecutingContext, Microsoft.AspNetCore.Mvc.Filters.ActionExecutionDelegate) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State ByRef, Scope ByRef, System.Object ByRef, Boolean ByRef) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync() at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State ByRef, Scope ByRef, System.Object ByRef, Boolean ByRef) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync() at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAwaitedAsync() at Microsoft.AspNetCore.Mvc.Controller.OnActionExecutionAsync(Microsoft.AspNetCore.Mvc.Filters.ActionExecutingContext, Microsoft.AspNetCore.Mvc.Filters.ActionExecutionDelegate) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State ByRef, Scope ByRef, System.Object ByRef, Boolean ByRef) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State ByRef, Scope ByRef, System.Object ByRef, Boolean ByRef) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeNextExceptionFilterAsync() at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State ByRef, Scope ByRef, System.Object ByRef, Boolean ByRef) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeNextResourceFilter() at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State ByRef, Scope ByRef, System.Object ByRef, Boolean ByRef) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync() at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeAsync()

    there are many more lines.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    If I set the application method to [AllowAnonymous], I van use postman to get a token, and receive a response. When I debug the Application method, the system does not decode the Token, resulting in the CurrentUser = NULL I do decode the Tenant info. This may be some ware between ABP framework migration from V3 to 4 to 5 to 6 to 7 to 8.3.3

    I think this is the default behavior of ASPNETCore.

    The new application has full access to the module can use all methods for all 12 entities. When I use the shell cmd : abp generate-proxy -t csharp -u https://localhost:44381/ only the "ApiParameters" proxies are added to the ClientProxies folder. I am unable to generate client proxies for a module application "Integration", only the host "ApiParameters" proxy. Is there a missing parameter?

    you need to add -m parameter

    https://abp.io/docs/latest/cli#generate-proxy

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    there are many more lines.

    could you provider a test project? i will check it. shiwei.liang@volosoft.com

  • User Avatar
    0
    Tony_Albutt created

    Hi

    Firstly, thanks, I missed the -m parameter with the test application. 😊

    The test project works = new version 8, the main one was created almost 5 years ago with version 3. migrating to V8

    I suspect that I am missing a migration step when moving from IdentityServer to OpenIddict with the AddJwtBearer??

    I added two changes that did not help

    Thanks and regards Tony

  • User Avatar
    0
    Tony_Albutt created

    I am getting a better error description now.

    To me, it looks as if the application is validating the token with AzureOpen ID and not a local account.

    I have removed the AddOpenIdConnect from the AddAuthentication, but still sends a request to https://login.microsoftonline.com

    When I request the token via Postman,

    [11:23:18 INF] The request URI matched a server endpoint: Token. [11:23:18 INF] The token request was successfully extracted: { "Content-Type": "application/json", "client_id": "ITX", "grant_type": "password", "username": "Peter", "password": "[redacted]", "client_secret": "[redacted]", "__tenant": "C0780FB1-38FB-2ABA-073B-39FD9C32D323", "scope": "address email phone roles profile ITX" }. [11:23:20 INF] The token request was successfully validated. [11:23:20 INF] Skipping the execution of current filter as its not the most effective filter implementing the policy Microsoft.AspNetCore.Mvc.ViewFeatures.IAntiforgeryPolicy [11:23:20 INF] Try to use LDAP for external authentication [11:23:20 WRN] Ldap login setting is not enabled! [11:23:20 INF] Try to use OAUTH for external authentication [11:23:20 INF] Start processing HTTP request GET https://login.microsoftonline.com/■■■■■■■■■■/v2.0/.well-known/openid-configuration [11:23:20 INF] Sending HTTP request GET https://login.microsoftonline.com/■■■■■■■■■■/v2.0/.well-known/openid-configuration [11:23:21 INF] Received HTTP response headers after 1105.3241ms - 200 [11:23:21 INF] End processing HTTP request after 1105.5083ms - 200 [11:23:21 INF] Start processing HTTP request GET https://login.microsoftonline.com/■■■■■■■■■■/discovery/v2.0/keys [11:23:21 INF] Sending HTTP request GET https://login.microsoftonline.com/■■■■■■■■■■/discovery/v2.0/keys [11:23:21 INF] Received HTTP response headers after 228.885ms - 200 [11:23:21 INF] End processing HTTP request after 229.0845ms - 200 [11:23:21 INF] Start processing HTTP request POST https://login.microsoftonline.com/■■■■■■■■■■/oauth2/v2.0/token [11:23:21 INF] Sending HTTP request POST https://login.microsoftonline.com/■■■■■■■■■■/oauth2/v2.0/token [11:23:22 INF] Received HTTP response headers after 306.9007ms - 400 [11:23:22 INF] End processing HTTP request after 307.0948ms - 400 [11:23:22 ERR] Get access token error: {"error":"invalid_grant","error_description":"AADSTS50034: The user account {EUII Hidden} does not exist in the ■■■■■■■■■■ directory. To sign into this application, the account must be added to the directory. Trace ID: 3c17edc8-ae32-4387-9a83-7e18be8a6800 Correlation ID: e8b7171a-4f6a-4c87-bb88-fb920b0aeb52 Timestamp: 2024-11-25 09:23:21Z","error_codes":[50034],"timestamp":"2024-11-25 09:23:21Z","trace_id":"3c17edc8-ae32-4387-9a83-7e18be8a6800","correlation_id":"e8b7171a-4f6a-4c87-bb88-fb920b0aeb52","error_uri":"https://login.microsoftonline.com/error?code=50034"} Volo.Abp.AbpException: Get access token error: {"error":"invalid_grant","error_description":"AADSTS50034: The user account {EUII Hidden} does not exist in the ■■■■■■■■■■ directory. To sign into this application, the account must be added to the directory. Trace ID: 3c17edc8-ae32-4387-9a83-7e18be8a6800 Correlation ID: e8b7171a-4f6a-4c87-bb88-fb920b0aeb52 Timestamp: 2024-11-25 09:23:21Z","error_codes":[50034],"timestamp":"2024-11-25 09:23:21Z","trace_id":"3c17edc8-ae32-4387-9a83-7e18be8a6800","correlation_id":"e8b7171a-4f6a-4c87-bb88-fb920b0aeb52","error_uri":"https://login.microsoftonline.com/error?code=50034"} at Volo.Abp.Identity.ExternalLoginProviders.OAuth.OAuthExternalLoginManager.GetAccessTokenAsync(String userName, String password) at Volo.Abp.Identity.ExternalLoginProviders.OAuth.OAuthExternalLoginManager.AuthenticateAsync(String userName, String password) [11:23:34 INF] The response was successfully returned as a JSON document: { "access_token": "[redacted]", "token_type": "Bearer", "expires_in": 3588 }.

    Postman token request

    API request from postman and

    Error on the application side.

    [11:33:56 ERR] Get access token error: {"error":"invalid_grant","error_description":"AADSTS50034: The user account {EUII Hidden} does not exist in the ■■■■■■■■■■ directory. To sign into this application, the account must be added to the directory. Trace ID: e5a8e6d6-f5f1-42d6-8b3a-63f0e85e6c00 Correlation ID: 28167e00-042a-4561-bf7c-cbcad01ae10e Timestamp: 2024-11-25 09:33:55Z","error_codes":[50034],"timestamp":"2024-11-25 09:33:55Z","trace_id":"e5a8e6d6-f5f1-42d6-8b3a-63f0e85e6c00","correlation_id":"28167e00-042a-4561-bf7c-cbcad01ae10e","error_uri":"https://login.microsoftonline.com/error?code=50034"} Volo.Abp.AbpException: Get access token error: {"error":"invalid_grant","error_description":"AADSTS50034: The user account {EUII Hidden} does not exist in the ■■■■■■■■■■ directory. To sign into this application, the account must be added to the directory. Trace ID: e5a8e6d6-f5f1-42d6-8b3a-63f0e85e6c00 Correlation ID: 28167e00-042a-4561-bf7c-cbcad01ae10e Timestamp: 2024-11-25 09:33:55Z","error_codes":[50034],"timestamp":"2024-11-25 09:33:55Z","trace_id":"e5a8e6d6-f5f1-42d6-8b3a-63f0e85e6c00","correlation_id":"28167e00-042a-4561-bf7c-cbcad01ae10e","error_uri":"https://login.microsoftonline.com/error?code=50034"} at Volo.Abp.Identity.ExternalLoginProviders.OAuth.OAuthExternalLoginManager.GetAccessTokenAsync(String userName, String password) at Volo.Abp.Identity.ExternalLoginProviders.OAuth.OAuthExternalLoginManager.AuthenticateAsync(String userName, String password) [11:34:07 INF] The response was successfully returned as a JSON document: { "access_token": "[redacted]", "token_type": "Bearer", "expires_in": 3590 }. [11:40:27 INF] The authentication demand was rejected because the token had no valid audience. [11:40:27 INF] OpenIddict.Validation.AspNetCore was not authenticated. Failure message: An error occurred while authenticating the current request. [11:40:27 INF] The response was successfully returned as a challenge response: { "error": "invalid_token", "error_description": "The specified token cannot be used with this resource server.", "error_uri": "https://documentation.openiddict.com/errors/ID2094" }. [11:40:27 INF] AuthenticationScheme: OpenIddict.Validation.AspNetCore was challenged.

    How do I make changes to the the following to prevent this issue? ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration)

    Best regards Tony

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Try to use OAUTH for external authentication The user account {EUII Hidden} does not exist in the ■■■■■■■■■■ directory. To sign into this application, the account must be added to the directory. Trace ID: e5a8e6d6-f5f1-42d6-8b3a-63f0e85e6c00 Correlation ID: 28167e00-042a-4561-bf7c-cbcad01ae10e

    This is because you configured the OAUTH for external authentication, if you don't want to use it, you can turn it off https://abp.io/docs/latest/modules/identity/oauth-login

  • User Avatar
    0
    Tony_Albutt created

    Hi

    looks that I was correct, close... I suspect that I am missing a migration step when moving from IdentityServer to OpenIddict with the AddJwtBearer??

    I found the issue preventing the token from been validated

    options.AddAudiences("ITX"); was incorrectly updated as options.AddAudiences("ITX ");

    There was a space after the ITX

                PreConfigure<OpenIddictBuilder>(builder =>
                {
                    builder.AddValidation(options =>
                    {
                        options.AddAudiences("ITX");
                        options.UseLocalServer();
                        options.UseAspNetCore();
                    });
                });
    

    Issues 1 and 3 seems to be resolved.

    More info for issue 1, please see next comment below.

    Thanks and regards Tony

  • User Avatar
    0
    Tony_Albutt created

    Thank you,

    I still have my original issue 2 from above.

    2 When I use the shell cmd : abp generate-proxy -t csharp -u https://localhost:44334/ my application breaks with the following error. System.StackOverflowException Looking for file /_/src/libraries/System.Private.CoreLib/src/System/Type.cs please select file.

    I don't have a file called Type.cs This error may be relates to the ABP CLI command.

    abp generate-proxy -t csharp -u https://localhost:44334/ -m Integration

    Locating source for '//src/libraries/System.Private.CoreLib/src/System/Type.cs'. Checksum: SHA256 { e7dbd6fe331ff9a3c4b24dd470ec1f19a71b7c5acf258b81ae7f761cd2b3019b } Searching opened files... Checking if document is part of a project... Searching script documents... Searching projects... Searching directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\include'... Searching directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\include\cvt'... Searching directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\include\msclr'... Searching directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\include\sys'... Searching directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\crt\src'... Searching directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\crt\src\x64'... Searching directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\crt\src\arm'... Searching directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\crt\src\concrt'... Searching directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\crt\src\i386'... Searching directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\crt\src\linkopts'... Searching directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\crt\src\stl'... Searching directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\crt\src\vccorlib'... Searching directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\crt\src\vcruntime'... Searching directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\atlmfc\src\mfc'... Searching directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\atlmfc\src\atl'... Searching directory 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\atlmfc\include'... Searching directory 'F:'... Searching for documents embedded in the symbol file... Not searching Source Link (option is disabled) Not searching Source Server (option is disabled) The debugger will ask the user to find the file: //src/libraries/System.Private.CoreLib/src/System/Type.cs. The user pressed Cancel in the Find Source dialog. The debug source files settings for the active solution have been modified so that the debugger will not ask the user to find the file: //src/libraries/System.Private.CoreLib/src/System/Type.cs. The debugger could not locate the source file '//src/libraries/System.Private.CoreLib/src/System/Type.cs'.

    So, for a short term solution, I will use my test solution for creating the Client Proxies for my Integration module.

    I don't know how much code I will have to reproduce in the test solution, to trigger the current proxy generation problem.

    Please let me know how I help.

    Thanks and regards Tony

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    When I use the shell cmd : abp generate-proxy -t csharp -u https://localhost:44334/ my application breaks with the following error. System.StackOverflowException Looking for file /_/src/libraries/System.Private.CoreLib/src/System/Type.cs please select file.

    can you share the full error message?

  • User Avatar
    0
    Tony_Albutt created

    Hello Shiwei

    This is the error from the PS cmd

    PS F:\TestingApi\src\TestingApi.Application> abp generate-proxy -t csharp -u https://localhost:44334/ -m Integration

    [08:44:00 INF] You are running the second generation of the ABP CLI. If you're interested in the legacy CLI, see https://abp.io/new-cli System.Net.Http.HttpRequestException: An error occurred while sending the request. System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.. System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host. at void System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) at int System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System .Int32>.GetResult(short token) at async ValueTask<int> System.Net.Security.SslStream.EnsureFullTlsFrameAsync<TIOAdapter>(CancellationToken cancellationToken, int estimatedSize) at TResult System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder1.StateMachineBox1.System.Threading.Tasks. Sources.IValueTaskSource<TResult>.GetResult(short token) at async ValueTask<int> System.Net.Security.SslStream.ReadAsyncInternal<TIOAdapter>(Memory<byte> buffer, CancellationToken cancellationToken) at TResult System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder1.StateMachineBox1.System.Threading.Tasks. Sources.IValueTaskSource<TResult>.GetResult(short token) at async ValueTask System.Net.Http.HttpConnection.InitialFillAsync(bool async) at async Task<HttpResponseMessage> System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, bool async, CancellationToken cancellationToken) at async Task<HttpResponseMessage> System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, bool async, CancellationToken cancellationToken) at async ValueTask<HttpResponseMessage> System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync( HttpRequestMessage request, bool async, bool doRequestAuth, CancellationToken cancellationToken) at async ValueTask<HttpResponseMessage> System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, bool async, CancellationToken cancellationToken) at async Task<HttpResponseMessage> Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler. <SendCoreAsync>g__Core|5_0(HttpRequestMessage request, bool useAsync, CancellationToken cancellationToken) at async Task<HttpResponseMessage> Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler. <SendCoreAsync>g__Core|5_0(HttpRequestMessage request, bool useAsync, CancellationToken cancellationToken) at async Task<string> System.Net.Http.HttpClient.GetStringAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken) at async Task<ApplicationApiDescriptionModel> Volo.Abp.Cli.ServiceProxying.ServiceProxyGeneratorBase1. GetApplicationApiDescriptionModelAsync(GenerateProxyArgs args, ApplicationApiDescriptionModelRequestDto requestDto) at async Task Volo.Abp.Cli.ServiceProxying.CSharp.CSharpServiceProxyGenerator.GenerateProxyAsync(GenerateProxyArgs args) at async Task Volo.Abp.Cli.Commands.ProxyCommandBase1.ExecuteAsync(CommandLineArgs commandLineArgs) at async Task Volo.Abp.Studio.Cli.StudioCliService.RunInternalAsync(CommandLineArgs commandLineArgs) at async Task Volo.Abp.Studio.Cli.StudioCliService.RunAsync(string[] args) Unhandled exception. System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.. ---> System.Net.Sockets.SocketException (10054): An existing connection was forcibly closed by the remote host. --- End of inner exception stack trace --- at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System.Int32>.GetResult(Int16 token) at System.Net.Security.SslStream.EnsureFullTlsFrameAsync[TIOAdapter](CancellationToken cancellationToken, Int32 estimatedSize) at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder1.StateMachineBox1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token) at System.Net.Security.SslStream.ReadAsyncInternal[TIOAdapter](Memory1 buffer, CancellationToken cancellationToken) at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder1.StateMachineBox1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token) at System.Net.Http.HttpConnection.InitialFillAsync(Boolean async) at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.<SendCoreAsync>g__Core|5_0(HttpRequestMessage request, Boolean useAsync, CancellationToken cancellationToken) at Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler.<SendCoreAsync>g__Core|5_0(HttpRequestMessage request, Boolean useAsync, CancellationToken cancellationToken) at System.Net.Http.HttpClient.GetStringAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken) at Volo.Abp.Cli.ServiceProxying.ServiceProxyGeneratorBase1.GetApplicationApiDescriptionModelAsync(GenerateProxyArgs args, ApplicationApiDescriptionModelRequestDto requestDto) at Volo.Abp.Cli.ServiceProxying.CSharp.CSharpServiceProxyGenerator.GenerateProxyAsync(GenerateProxyArgs args) at Volo.Abp.Cli.Commands.ProxyCommandBase`1.ExecuteAsync(CommandLineArgs commandLineArgs) at Volo.Abp.Studio.Cli.StudioCliService.RunInternalAsync(CommandLineArgs commandLineArgs) at Volo.Abp.Studio.Cli.StudioCliService.RunAsync(String[] args) at Volo.Abp.Studio.Cli.Program.IrXAxCPfc(Object ) at Volo.Abp.Studio.Cli.Program.

    (String[] args)

    PS F:\TestingApi\src\TestingApi.Application>

    This is the exception

    I have emailed you the full error log and call stack

    Thanks again

    All the best

    Regards Tony

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host..

    Your API Host is not available

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    I think this may be related to your code(services,DTOs property).

    could you please share a test project with me?

  • User Avatar
    0
    Tony_Albutt created

    Hi

    My test application works, the one that was created 5 years ago does not. That one was created with version 3 and migrated to version 4,5,6,7 and then 8. I don't think that it is possible for me to follow the above steps with a new test application.

    Cool, what makes my API available to the abp generate-proxy command

    My API is available, to Swagger.

    After the code fix " options.AddAudiences("ITX")

    I am able to request a token using Postman I am able to Request data from the API and authenticate with the Token using Postman

    I can use an second ABP application using HttpClient, and using the clientid = ITX and ITX_App from above, Request a token using HttpClient and then request data using HttpClient and adding the token

    Thanks for your assistance.

    Best regards Tony

  • User Avatar
    0
    Tony_Albutt created

    Hello Shiwei

    There may be an issue causing the problem

    I have not hidden any application Endpoints from swagger. I have many Application services that are API calls to external systems.

    Could this be causing the issue?

    Thanks and regards Tony

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