Openid Connect Architecture

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up an openid connect architecture by linking your app to a central identity provider. This setup lets users log in once and proves who they are with signed tokens. Most teams start by registering their apps with an identity provider. Then they map user groups to broad system roles. When these roles grant too much power, one logged-in user can run risky commands across many systems. How openid connect architecture works in practice OpenID Connect sits on top of the OAuth 2.0 protocol.

Zero Trust Architecture + OpenID Connect (OIDC): the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

You set up an openid connect architecture by linking your app to a central identity provider. This setup lets users log in once and proves who they are with signed tokens. Most teams start by registering their apps with an identity provider. Then they map user groups to broad system roles. When these roles grant too much power, one logged-in user can run risky commands across many systems.

How openid connect architecture works in practice

OpenID Connect sits on top of the OAuth 2.0 protocol. OAuth 2.0 handles what a user can do, while OpenID Connect checks who the user is. The flow uses three main parts: the user, the client app, and the identity provider.

First, a user tries to log in to a client app. The app sends the user to the identity provider login page. The user enters their password and passes a second factor check. Next, the identity provider sends a short code back to the client app.

The client app trades this code for two tokens over a secure back channel. It gets an access token and an ID token. The ID token is a JSON Web Token that holds user details like an email address. It also holds group claims and a digital signature from the identity provider.

The client app checks the signature using public keys from the identity provider. It also checks that the token has not expired. If the checks pass, the app trusts the user identity and starts a session. The app can also call a user info endpoint to fetch more profile data.

Choosing the right login flow for your apps

Not every app runs in the same place. Server apps can keep a client secret safe on the backend. Browser apps and mobile apps cannot hide secrets from the person using the device. Nor can command-line tools hide embedded keys on a developer laptop.

For public apps, teams add Proof Key for Code Exchange to the login flow. The app creates a one-time secret code before the login starts. It sends a hash of this code to the identity provider. When trading the login code for tokens, the app sends the raw secret code.

Zero Trust Architecture + OpenID Connect (OIDC): architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

This step proves the same app started and finished the login flow. Stolen login codes become useless to attackers on the same network. Teams also set short lifetimes on ID tokens and access tokens. When a token expires, the app uses a refresh token to get a new one.

What native identity setup solves and what it misses

A clean login setup solves the problem of scattered passwords. Your team manages all user accounts in one directory. When someone leaves the company, you disable one account to block new logins everywhere. Apps do not store passwords or build their own login forms.

Still, this login check only happens at the front door. The identity provider decides who logs in, not what commands they run afterward. Once a developer or service gets a valid session, the token check is over. If an engineer maps to a write role, every query in that session runs in full.

Native login flows cannot inspect a live database query or a shell command in flight. They do not pause a drop table statement for peer review. They also do not rewrite sensitive fields like emails, phone numbers, or card numbers in query results. Managing safety inside the active session requires controls beyond the initial login handshake.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits inline in the protocol beside the service as an open-source proxy, a sidecar for your database or API. On every production query an agent or human runs, hoop.dev decides whether to pass, mask, block, or escalate it for review.

Before a query runs, hoop.dev guardrails check the statement against your rules, an AI Analyzer you configure can score intent or hold risky calls for human approval, and hoop.dev data masking rewrites sensitive fields in responses in memory. Explore the MIT-licensed project on GitHub.

Frequently asked questions

What is the difference between an ID token and an access token?

An ID token proves who the user is to the client app. An access token grants permission to call a specific API or resource.

How does an app check if an ID token is real?

The app fetches public keys from the identity provider discovery endpoint. It uses those keys to check the digital signature on the token.

Does OpenID Connect control what queries a user runs in a database?

No, OpenID Connect only verifies identity during the login flow. It does not inspect or filter individual database queries after the session starts.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.