3.72Disabling Automatic Access Token Management
Created on Aug 17, 2026~2 min read
The framework has a built-in automatic Access Token management feature: you only need to implement the IHttpAccessTokenProvider interface and write the logic for obtaining the Access Token in the GetAsync method. Usually, obtaining an Access Token requires a separate HTTP request, but if you directly use IHttpRemoteService inside GetAsync to send a request, it will trigger the automatic management mechanism and fall into infinite recursive calls. In this case, you need to explicitly disable the automatic Access Token management for the current request via .WithoutTokenManagement() to avoid recursive calls.
public class CustomHttpAccessTokenProvider(IHttpRemoteService httpRemoteService): IHttpAccessTokenProvider{ /// <inheritdoc /> public async Task<HttpAccessToken?> GetAsync(CancellationToken cancellationToken) { var serverToken = await httpRemoteService.SendAsAsync<YourServerToken>(HttpRequestBuilder.Post("https://furion.net") .SetJsonContent(new { username = "furion", password = "your-password"}) .WithoutTokenManagement()); // Skip token management to avoid recursive calls (Declarative Requests use [SuppressTokenManagement]) return new HttpAccessToken(serverToken.Token, serverToken.ExpiresAt) };}