6

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?

Mostafiz
  • 7,243
  • 3
  • 28
  • 42
tVoss42
  • 554
  • 4
  • 16

1 Answers1

15

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!

tVoss42
  • 554
  • 4
  • 16