The templates use appsettings.json
file to configure the client. The AddClients()
method inside AddApiAuthorization()
registers an Enumerable.Empty<Client>
and then goes to add the clients from the appsettings file.
builder.AddInMemoryClients(Enumerable.Empty<Client>());
Is it possible to change the Enumerable.Empty<Client>
to ConcurrentBag<Client>
and add clients at run time?
I am probably not thinking about all this correctly.
I found the correct way to add clients to dotnet template generated code.
inject
IOptions<ApiAuthorizationOptions>
and use the_options.Value.Clients
object to add the client.This following example should get you started on the right path.
Hope this saves some time for you.