Open Closed

Problem with refreshing access token in Maui Blazor project #7053


User avatar
0
olitrepanier created
  • ABP Framework version: v7.4.2

  • UI Type: Blazor WASM and Maui Blazor

  • Database System: SQL Server

  • Tiered (for MVC) or Auth Server Separated (for Angular): no

  • Exception message and full stack trace: blazor.webview.js:1 Uncaught (in promise) Error: Volo.Abp.Http.Client.AbpRemoteCallException: Unauthorized at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.<ThrowExceptionForResponseAsync>d__42[[Entrenou.Pharmacies.IPharmaciesAppService, Entrenou.Application.Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext() in D:\ci\Jenkins\workspace\abp-volo-release\abp\framework\src\Volo.Abp.Http.Client\Volo\Abp\Http\Client\ClientProxying\ClientProxyBase.cs:line 258 at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.<RequestAsync>d__36[[Entrenou.Pharmacies.IPharmaciesAppService, Entrenou.Application.Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext() in D:\ci\Jenkins\workspace\abp-volo-release\abp\framework\src\Volo.Abp.Http.Client\Volo\Abp\Http\Client\ClientProxying\ClientProxyBase.cs:line 161 at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase1.<RequestAsync>d__351[[Entrenou.Pharmacies.IPharmaciesAppService, Entrenou.Application.Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.Collections.Generic.List1[[Entrenou.Pharmacies.PharmacyInMapDto, Entrenou.Application.Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext() in D:\ci\Jenkins\workspace\abp-volo-release\abp\framework\src\Volo.Abp.Http.Client\Volo\Abp\Http\Client\ClientProxying\ClientProxyBase.cs:line 86 at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptorClientProxy1.<CallRequestAsync>d__01[[Entrenou.Pharmacies.IPharmaciesAppService, Entrenou.Application.Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.Collections.Generic.List1[[Entrenou.Pharmacies.PharmacyInMapDto, Entrenou.Application.Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext() in D:\ci\Jenkins\workspace\abp-volo-release\abp\fram

  • Steps to reproduce the issue:

  1. On a Maui Blazor project, have an expired access token
  2. Call the api with expired access token
  3. Api returns an exception with Unauthorized

We noticed a difference between our Blazor and Maui Blazor versions of the app. On Blazor, when the access token is expired, the application attempts to refresh the token before sending a request to the api. Therefore, the api doesn't return an exception and everything is fine.

On the other hand, in Maui Blazor, the app doesn't seem to refresh the expired token before sending a request. Thus, the api returns an unauthorized exception and our application shows us the reload button.

We also noticed that in our Blazor project, there isn't any refresh token and the login flow seems to be triggered instead (without asking the user to reenter credentials). In Maui Blazor, we do have a refresh token. Heres a screenshot of the http requests for the blazor project:


2 Answer(s)
  • User Avatar
    0
    olitrepanier created

    The problem is easily reproduced with a newly scaffolded Maui Blazor project. It seems like the token refresh doesn't work at all, or doesn't even occur.

    Heres a link to the zipped solution: https://filetransfer.io/data-package/3xvB5DqT#link

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    ABP does not implement refresh token for MAUI Blazor, I will add it in next version

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09