I'm trying to follow this tutorial on Adding User Authentication with OpenID Connect from the Identity Server 4 docs but I get the following error when I start up the mvc client:
InvalidOperationException: Unable to resolve service for type 'IdentityServer4.Services.IIdentityServerInteractionService' while attempting to activate 'IdentityServer4.Quickstart.UI.HomeController'.
How do I go about registering the Identity Server Interaction Service? Its sounds like an issue with DI.
You get this error when there is no implementation available of the interface IIdentityServerInteractionService
in the dependency injection container.
The HomeController of the Quickstart example requests for an implementation of IIdentityServerInteractionService
in the constructor:
public HomeController(IIdentityServerInteractionService interaction)
{
_interaction = interaction;
}
You should add services.AddIdentityServer();
in the ConfigureServices
method in your startup class. IdentityServer will inject an implementation of IIdentityServerInteractionService
, namingly the DefaultIdentityServerInteractionService
.
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