- ABP Framework version: v7.2.2
- UI Type: Angular
- Database System: EF Core (SQL Server)
- Tiered (for MVC) or Auth Server Separated (for Angular): yes
- Exception message and full stack trace: Below
- Steps to reproduce the issue:Below
Hello,
We are encountering a strange problem when trying to send a refresh token. It seems that the OpenIddict Module or .NET won't accept the length of the refresh token. The endpoint is returning the following error: "Form key length limit 2048 exceeded." The question is: Should we set the form value limit to accommodate the refresh token, or is there a way to compress its size?
Exception: [auth-server_1de50682-b]: [18:18:48 INF] Request starting HTTP/1.1 POST https://127.0.0.1:44322/connect/token application/x-www-form-urlencoded 4619 [auth-server_1de50682-b]: [18:18:48 DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessRequestContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ResolveRequestUri. [auth-server_1de50682-b]: [18:18:48 DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ResolveRequestUri. [auth-server_1de50682-b]: [18:18:48 INF] The request URI matched a server endpoint: Token. [auth-server_1de50682-b]: [18:18:48 DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.OpenIddictServerHandlers+InferEndpointType. [auth-server_1de50682-b]: [18:18:48 DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by Volo.Abp.Account.Web.Pages.Account.OpenIddictImpersonateInferEndpointType. [auth-server_1de50682-b]: [18:18:48 DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ValidateHostHeader. [auth-server_1de50682-b]: [18:18:48 DBG] An exception was thrown by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ExtractPostRequest`1[[OpenIddict.Server.OpenIddictServerEvents+ExtractTokenRequestContext, OpenIddict.Server, Version=4.2.0.0, Culture=neutral, PublicKeyToken=35a561290d20de2f]] while handling the OpenIddict.Server.OpenIddictServerEvents+ExtractTokenRequestContext event. [auth-server_1de50682-b]: System.IO.InvalidDataException: Form key length limit 2048 exceeded. [auth-server_1de50682-b]: at Microsoft.AspNetCore.WebUtilities.FormPipeReader.ThrowKeyTooLargeException() [auth-server_1de50682-b]: at Microsoft.AspNetCore.WebUtilities.FormPipeReader.ParseValuesSlow(ReadOnlySequence`1& buffer, KeyValueAccumulator& accumulator, Boolean isFinalBlock) [auth-server_1de50682-b]: at Microsoft.AspNetCore.WebUtilities.FormPipeReader.ParseFormValues(ReadOnlySequence`1& buffer, KeyValueAccumulator& accumulator, Boolean isFinalBlock) [auth-server_1de50682-b]: at Microsoft.AspNetCore.WebUtilities.FormPipeReader.ReadFormAsync(CancellationToken cancellationToken) [auth-server_1de50682-b]: at Microsoft.AspNetCore.Http.Features.FormFeature.InnerReadFormAsync(CancellationToken cancellationToken) [auth-server_1de50682-b]: at OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers.ExtractPostRequest`1.HandleAsync(TContext context) [auth-server_1de50682-b]: at OpenIddict.Server.OpenIddictServerDispatcher.DispatchAsync[TContext](TContext context) [auth-server_1de50682-b]: at OpenIddict.Server.OpenIddictServerDispatcher.DispatchAsync[TContext](TContext context) [auth-server_1de50682-b]: at OpenIddict.Server.OpenIddictServerHandlers.Exchange.ExtractTokenRequest.HandleAsync(ProcessRequestContext context) [auth-server_1de50682-b]: at OpenIddict.Server.OpenIddictServerDispatcher.DispatchAsync[TContext](TContext context) [auth-server_1de50682-b]: [18:18:48 DBG] An exception was thrown by OpenIddict.Server.OpenIddictServerHandlers+Exchange+ExtractTokenRequest while handling the OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext event.
2 Answer(s)
-
0
hi
System.IO.InvalidDataException: Form key length limit 2048 exceeded.
You can configure the
KeyLengthLimit
ofFormOptions
.https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.http.features.formoptions.keylengthlimit?view=aspnetcore-7.0
-
0
hi
System.IO.InvalidDataException: Form key length limit 2048 exceeded.
You can configure the
KeyLengthLimit
ofFormOptions
.It worked. Thanks!