you need a on perm oauth server. While no longer free you might be interested in identity server.
https://duendesoftware.com/products/identityserver
you can google for webapi jwt samples, but most are not very secure.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi Community members,
How can I create oauth in web api where validation is not in cloud
you need a on perm oauth server. While no longer free you might be interested in identity server.
https://duendesoftware.com/products/identityserver
you can google for webapi jwt samples, but most are not very secure.
Hello,
To implement a self-hosted OAuth solution for your Web API, you need to create your own central identity provider. This server will handle user logins and issue security tokens that your API will trust.
The professional standard for building this in .NET is Duende IdentityServer. It's a security-hardened framework that correctly implements the necessary protocols (OAuth 2.0 and OpenID Connect), saving you from the extreme risk of trying to build it yourself.
Here’s a breakdown of the architecture:
1. The IdentityServer Project
This is a dedicated ASP.NET Core application you create. Its responsibilities are:
2. The Web API Project (Your "Resource Server")
This is your existing API. You add and configure authentication middleware:
[Authorize]
attribute on your controllers or endpoints will grant or deny access based on the validated token. Your API doesn't need to know the user's password; it just needs to trust the token.3. The Client Project (e.g., a Web App, SPA, or Mobile App)
This is the user-facing application:
This setup decouples authentication from your APIs, creating a more secure and maintainable system. To get started, you would follow the Duende IdentityServer quick-start guides to build the IdentityServer project first, then configure your API to use it.
Hope this helps!