IdentityServer4 is an OpenID Connect and OAuth 2.0 framework for ASP.NET Core or that is what it says in the tin. This open source software has been designed to add complementary parts, what I am trying to say is, that this is not a finished product. If you want to integrate it, you have to work on it.
The way it works it is simple but very complex because there is a middleware written, that makes the whole process invisible. So for you, it should be very simple to add but to modify it is a different subject.
So in order to make everything to work smoothly I decided to create different scenarios, to see how Identity works.
Folder Structure: One solution with four projects, where one of them is Identity Server.
We create a simple .NET Core console App. This is going to act as a consumer of Identity Server. So it is going to be the guy in charge of calling Identity getting the authentication and then call the API with that token issued by Identity Server.
We can copy all this code in the program.cs, don´t forget to put your own namespace. In this case I have call the project “Console.Consumer.Identity”.