Open Closed

Localize connect/token Endpoint's error_description #4489


User avatar
0
a7mdfre7at created

Hello,

I'm trying to localize error descriptions that returned from connect/token endpoint, if there is a way to do that, could you produce it?

As a try to do that, I decided to override some methods from TokenController to return localized error_description, but I couldn't find the controller in Volo.Abp.OpenIddict.Controllers namespace.

Please advice.

  • ABP Framework version: v6.0.3
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

5 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Yes, the way is to override the TokenController.

    but I couldn't find the controller in Volo.Abp.OpenIddict.Controllers namespace.

    Are you using the OpenIddict? you need to custom it in the AuthServer(if exists) or HttpApi.Host project

  • User Avatar
    0
    a7mdfre7at created

    I'm using the default authentication provider,

    I have HttpApi.Host, could you please provide me detailed steps to override it?

    Yes, the way is to override the TokenController.

    but it does not exist or provide me with its namespace.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Can you share the .csproj file content?

    BTW, it's working for me:

    [Dependency(ReplaceServices = true)]
    [ExposeServices(typeof(TokenController))]
    public class MyTokenController : Volo.Abp.OpenIddict.Controllers.TokenController
    {
        protected override Task<IActionResult> HandlePasswordAsync(OpenIddictRequest request)
        {
            return base.HandlePasswordAsync(request);
        }
    }
    
    

  • User Avatar
    0
    a7mdfre7at created

    Hi, Here is the .csproj file content

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    The project you're shared is HttpApi not HttpApi.Host.

    You can look up which project references the Volo.Abp.Account.Pro.Public.Web.OpenIddict package and custom TokenController in it.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 05, 2024, 12:19