Method Bearer
Bearer(Func<ValueTask<AuthTokenAndExpiration>>)
An implementation of IAuthTokenManager that will call the provided async function whenever a token is needed. It will cache the token and will only call the function when a new token is needed or the existing cached token has expired.
public static IAuthTokenManager Bearer(Func<ValueTask<AuthTokenAndExpiration>> tokenProviderAsync)
Parameters
tokenProviderAsyncFunc<ValueTask<AuthTokenAndExpiration>>A function that will be called when a new token is needed.
Returns
- IAuthTokenManager
The IAuthTokenManager that will call the provided function when a new token is needed.