OpenID Connect (OIDC) is an authentication protocol built on OAuth 2.0. It lets an application rely on an identity provider to authenticate users, rather than storing their credentials itself. OIDC adds conventions and discovery to OAuth 2.0, helping applications retrieve user identity information. section 25.1.3 section 25.7
OAuth 2.0 is concerned with delegated authorization: a user can let an application access a resource without giving it their credentials. OpenID Connect builds on that flow to answer a different question: which user authenticated? section 25.1.3
Signing in with an identity provider
A photo-printing service can redirect a user to Facebook, where the user signs in and consents to the requested access. In the OAuth 2.0 example, the service receives an authorization code and exchanges it using a shared secret. An OpenID Connect flow follows the same overall pattern but also provides an identity token describing the authentication event and an API call to retrieve identity details. section 25.1.3
Figure 25.6 Using OpenID Connect to authenticate with Facebook and retrieve identity information. The overall flow is the same as with Oauth 2.0, as shown in figure 25.5, but with an additional identity token describing the authentication event and API call to retrieve the identity details.
Compare the OpenID Connect flow with OAuth 2.0: the identity token and identity-details call add authentication information. section 25.1.3
In a Backend for Frontend (BFF) pattern, an ASP.NET Core backend handles OpenID Connect authentication, stores bearer tokens, and sets an authentication cookie. The browser sends the cookie to the backend, which uses a bearer token to call the API. This keeps bearer tokens out of the browser, but requires an additional backend service. section 25.2
Keep these practical details in mind:
- Preregister allowed redirect URLs and redirect only to a registered URL. OpenID Connect flows may need external redirects, so a local-only redirect check is not always suitable. section 29.4.1
- When receiving a JWT, always verify its signature. A JWT is not encrypted by default, so its contents can be read. section 25.7
- An OpenAPI security scheme can describe OpenID Connect. In Swagger UI, choosing Authorize can then redirect users to the identity provider to sign in and retrieve a token. section 25.5
- A third-party identity provider can reduce user-management responsibilities. If you need your own provider, IdentityServer or OpenIddict can implement OpenID Connect, but you still build the user-management and UI components. section 25.7












