What happened to the AddAccessTokenManagement extension method? #164
-
I'm working on a fairly new project that uses the IdentityModel.AspNetCore NuGet package and uses the AddAccessTokenManagement extension method. However, that IdentityModel.AspNetCore package no longer exists. According to the Duende documentation linked to below, there should be an AddAccessTokenManagement method in the Duende.AccessTokenManagement package, but there's not. https://docs.duendesoftware.com/identityserver/tokens/requesting |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Good catch! You can add the necessary services to ASP.NET Core's service provider by calling // Program.cs
builder.Services.AddClientCredentialsTokenManagement()
.AddClient("client", client =>
{
client.TokenEndpoint = "https://demo.duendesoftware.com/connect/token";
client.ClientId = "m2m";
client.ClientSecret = "secret";
client.Scope = "api";
}); You can then register named HTTP clients with // Program.cs
builder.Services.AddClientAccessTokenHttpClient("client", configureClient: client =>
{
client.BaseAddress = new Uri("https://demo.duendesoftware.com/api/");
}); We'll get the docs updated here. |
Beta Was this translation helpful? Give feedback.
Good catch! You can add the necessary services to ASP.NET Core's service provider by calling
AddClientCredentialsTokenManagement()
. One or more named client definitions need to be registered by callingAddClient()
.You can then register named HTTP clients with
IHttpClientFactory
. These named clients will automatically use the above client definitions to request and use access tokens./…