akunzai / gss.authorization.oauth Goto Github PK
View Code? Open in Web Editor NEWOAuth authorized HttpClient, friendly with HttpClientFactory
License: MIT License
OAuth authorized HttpClient, friendly with HttpClientFactory
License: MIT License
Describe the bug
Using AddOAuth2HttpClient throws "The HttpClient factory already has a registered client with the name" error for duplicate TAuthorizer used
To Reproduce
Steps to reproduce the behavior:
Update Microsoft.Extensions.Http to 3.0.0 and run following code
var collection = new ServiceCollection();
var services = collection.AddOAuth2HttpClient<ClientCredentialsAuthorizer>("client1", (resolver, options) =>
{
options.AccessTokenEndpoint = new Uri("https://example.com");
options.ClientId = "foo";
options.ClientSecret = "bar";
}).Services.AddOAuth2HttpClient<ClientCredentialsAuthorizer>("client2", (resolver, options) =>
{
options.AccessTokenEndpoint = new Uri("https://example.com");
options.ClientId = "foo";
options.ClientSecret = "bar";
}).Services.BuildServiceProvider();
Expected behavior
The ClientCredentialsAuthorizer instance should only registeded once.
and should not throw exceptions.
Screenshots
Additional context
Reference issues
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.
Microsoft.AspNetCore.WebUtilities
, Microsoft.Extensions.Caching.Memory
, Microsoft.Extensions.Http
, Microsoft.Extensions.Options
, System.ComponentModel.Annotations
, System.Text.Encodings.Web
, System.Text.Json
).github/workflows/cd.yml
actions/checkout v4
actions/setup-dotnet v3
.github/workflows/ci.yml
actions/checkout v4
actions/setup-dotnet v3
codecov/codecov-action v3
.config/dotnet-tools.json
dotnet-reportgenerator-globaltool 5.2.0
Directory.Packages.props
xunit 2.6.2
Xunit.SkippableFact 1.4.13
xunit.runner.visualstudio 2.5.4
System.Threading.Tasks.Extensions 4.5.4
System.Text.RegularExpressions 4.3.1
System.Net.Http 4.3.4
RichardSzalay.MockHttp 7.0.0
Newtonsoft.Json 13.0.3
Microsoft.NET.Test.Sdk 17.8.0
coverlet.collector 6.0.0
System.Text.Json 4.7.2
System.Text.Encodings.Web 4.7.2
System.ComponentModel.Annotations 4.7.0
Microsoft.Extensions.Options 2.2.0
Microsoft.Extensions.Http 2.2.0
Microsoft.Extensions.Caching.Memory 2.2.0
Microsoft.AspNetCore.WebUtilities 2.2.0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.