Polhem.OAuth2 1.5.0 adds GitHub, Apple and any OpenID Connect provider to a single sign-in library for ASP.NET Core, desktop and MAUI apps, and makes the back end own the sign-in.
Key points
- Version 1.4.0 added Apple and GitHub plus generic OIDC; 1.5.0 adds LoopbackRelayClient for desktop sign-in.
- OidcOAuth2Options.FromDiscoveryAsync reads /.well-known/openid-configuration once at startup for Keycloak, GitLab or Cognito.
- GetUserInfoAsync(accessToken) is gone; when a back end exists, the back end always runs the sign-in.
- Breaking: ID tokens are now validated for audience and subject, and for issuer on Google and Auth0.
- Breaking: unverified emails come back as null in UserInfo.Email instead of reaching your app.
- The loopback relay accepts only 127.0.0.1 and [::1], never localhost, and checks a state value.
Why it matters
Most .NET teams still reach for the ASP.NET Core authentication handlers, which keeps everything inside the web app and leaves desktop and MAUI clients out. A library that splits those flows, and now insists the back end performs the sign-in whenever one exists, matches how token substitution is actually closed: the front end never hands a provider token to your API.
The cost sits in the upgrade. Versions 1.4.0 and 1.5.0 replace GetUserInfoAsync and tighten ID token checks, so test Google, Entra ID, Auth0 and Okta sign-ins before deploying and review anything that mapped accounts by email. Weigh it as a small, opinionated alternative to the built-in handlers, not a drop-in replacement for them.
Real-world use
- A desktop or console app that keeps the provider client secret in its own ASP.NET Core back end instead of inside the binary.
- .NET MAUI on Android signing in with GitHub or Apple, where a client secret cannot ship inside the app.
- A web app that connects to a self-hosted Keycloak, GitLab or AWS Cognito tenant through one generic OIDC configuration.
- An app with an existing back end that maps provider users to its own accounts and issues its own session.
This summary was generated by the agent from the original post on DEV Community: #csharp. The full text and all rights belong to its author and publisher. Go to original