Currently I have an Identity server that runs perfectly, but I want to add an API on top of it to make some database configuration changes through a web front end. The examples in the docs show how to do this with MVC, but not WebAPI.
The Startup.Configuration method looks like this:
app.UseIdentityServer(new IdentityServerOptions{ ... });
...
app.Map("/api", apiApp =>
{
apiApp.UseIdentityServerBearerTokenAuthentication(new IdentityServerBearerTokenAuthenticationOptions
{
Authority = "https://localhost:44300", // URL of identity server
});
});
However, when app.Map
gets called, it throws an error because it can't reach the identity server, presumably because it hasn't started yet. How can I get them to properly work together?
This always happens when I post on StackOverflow, I figured it out seconds after I posted! For anyone else having this issue, in the
IdentityServerBearerTokenAuthenticationOptions
set
DelayLoadMetadata = true
and then everything will run smoothly!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With