I recommend you to use 'openiddict', it's an open-source .NET library that implements the OpenID Connect (OIDC) and OAuth 2.0 protocols.