Passwords & identity

What Is OpenID Connect? How OIDC Login Works, Tokens and Flows

OpenID Connect is why you can sign in to an app with your Google or Microsoft account instead of a new password. Here is how the protocol works.

Cysoro Security TeamPublished · 9 min read
PASSWORDS & IDENTITYWhat isOpenID Connect?The identity layer behind "Sign in with Google"IDID tokensigned JWTwho are you?CYSORO
Quick answer

OpenID Connect (OIDC) is an identity authentication protocol built on OAuth 2.0. It lets an app verify who a user is through a trusted identity provider, such as Google or Microsoft, using a signed ID token, so the app never needs to store the user's password.

Key takeaways

  • OpenID Connect adds authentication to OAuth 2.0, which on its own only handles authorization.
  • The ID token is a signed JWT that tells the app who the user is and how they were authenticated.
  • The authorization code flow with PKCE is the flow most apps should use today.

You click "Sign in with Google" on a new app, approve it once, and you are in — no new account, no new password. Behind that one click is OpenID Connect, the protocol that lets apps trust Google or Microsoft to answer one question: who is this person?

What is OpenID Connect?

OpenID Connect (OIDC) is an interoperable authentication protocol based on the OAuth 2.0 framework. It lets an app verify a user's identity through an authorization server and obtain profile information in a standard, REST-like way.

The OpenID Foundation describes it on How OpenID Connect Works as a way for developers to launch sign-in flows and receive verifiable assertions about users across web, mobile, and JavaScript clients. It removes the responsibility of setting, storing, and managing passwords from each individual app, which is a frequent source of credential breaches.

OIDC is an open standard, maintained by the OpenID Foundation, and it is widely supported. Google, Microsoft, Apple, Amazon, and many enterprise identity providers implement it, which is why the same "Sign in with" buttons work across so many sites.

How is OpenID Connect different from OAuth 2.0?

OAuth 2.0 and OpenID Connect are related but answer different questions. OAuth 2.0 is an authorization framework: it lets an app access your data on another service with your permission, without seeing your password. OpenID Connect adds authentication on top of it.

Microsoft puts it plainly: OIDC provides authentication, which means verifying that users are who they say they are, while OAuth 2.0 authorizes which systems those users are allowed to access. In short, OAuth answers "what may this app do?" and OIDC answers "who is this user?"

OAuth 2.0OpenID Connect
Question answeredWhat may the app access?Who is the user?
Main tokenAccess tokenID token, plus access token
PurposeAuthorizationAuthentication, plus authorization
StandardIETF RFC 6749 and 6750OpenID Connect Core 1.0, built on OAuth 2.0
User infoNo standard identity formatStandard claims and UserInfo endpoint
ExampleAn app reading your calendar"Sign in with Google"

A common mistake is to use OAuth 2.0 alone for login, by assuming that anyone who holds an access token must be the right user. That is not safe. OAuth access tokens say nothing reliable about identity, which is exactly the gap OIDC was created to fill.

How does OpenID Connect work?

At a high level, OIDC follows seven steps. The user signs in once with the identity provider, and the app receives tokens that prove the result.

  1. You visit an app and click sign in.
  2. You enter your credentials with the identity provider, not the app.
  3. The app sends a request to the OpenID Provider, asking it to authenticate you.
  4. The provider authenticates you and obtains your authorization to share information.
  5. The provider responds with an ID token and usually an access token.
  6. The app can send the access token to access protected resources on your behalf.
  7. The UserInfo endpoint returns claims about you, such as your name and email address.

The app never sees your password. It only sees the tokens the provider issues, and it verifies the ID token's signature before trusting the claims inside it. If the signature does not check out, the app must reject the login.

OpenID Connect sign-in in six steps1. User clicks sign inon the app (relying party)2. Redirect to provideruser signs in there3. Provider verifiesidentity and consent4. Code returnedto the app5. Code exchangedfor ID and access tokens6. App verifies tokenthen signs the user inYour password stays with the provider. The app only gets tokens.Source: OpenID Foundation, How OpenID Connect Works.
The OIDC sign-in flow: the app asks the provider to verify you. Illustration by Cysoro.

Who are the key players in OIDC?

OIDC uses a small set of roles. Learning them makes the specification, and most error messages, much easier to read.

  • End user: the person signing in.
  • Relying party (RP), also called the client: the app or website that outsources authentication to the provider. It must be registered with the provider.
  • OpenID Provider (OP), also called the identity provider (IdP): the service that authenticates the user and issues tokens, such as Google, Microsoft Entra ID, or Okta.
  • Authorization server: the part of the provider that authenticates the user and authorizes the request. In OIDC, the provider and authorization server are usually the same service.
  • UserInfo endpoint: a protected endpoint the app can call with the access token to fetch claims about the user.

Any entity can in principle run an OpenID Provider, although in practice most users sign in through a large provider they already trust. That trust is the point: the app does not need to judge your password, only the provider's signed token.

What tokens does OIDC use?

OIDC uses three tokens, each with a different job. Confusing them is one of the most common implementation mistakes.

TokenWhat it isWhat it is for
ID tokenA signed JWT with claims about the authenticationProving who the user is
Access tokenAn opaque or JWT tokenCalling APIs, such as the UserInfo endpoint
Refresh tokenA long-lived token, issued only with offline_accessGetting new access tokens without signing in again

The ID token is the new piece OIDC adds. It is a JSON Web Token that contains, at minimum, an identifier for the user (the sub claim) and information about how and when the user authenticated. It can contain additional identity data, such as name and email address.

Standard ID token claims include iss (the issuer), sub (the user's unique identifier), aud (the audience, which must be the app's client ID), exp (when the token expires), iat (when it was issued), and nonce (a value that ties the token to this login attempt and prevents replay attacks). An app must check the issuer, audience, expiry, and signature before trusting any of them.

Never use an ID token as an access token, and never send an access token to prove identity. The ID token is for authentication. The access token is for authorization.

What are the OIDC flows?

OIDC defines three flows that describe how tokens are requested and delivered. Most apps today should use only one of them.

Authorization code flow

This is the recommended flow for web apps, mobile apps, and single-page apps. The provider returns a short-lived authorization code to the app, which then exchanges it for tokens on a back channel, away from the browser. Because tokens never pass through the browser address bar, it is the safest option.

Implicit flow

The implicit flow returned tokens directly in the browser redirect. It was designed for JavaScript apps before better options existed. It is now discouraged, because tokens in the URL can leak through browser history, logs, and referrer headers. Use the authorization code flow with PKCE instead.

Hybrid flow

The hybrid flow returns some tokens in the redirect and the rest through the code exchange. It is used by a small number of apps that need an ID token immediately in the browser. Most apps do not need it.

PKCE strengthens the authorization code flow. The app creates a random code verifier before redirecting you, and must present it when exchanging the code for tokens. A stolen authorization code alone is therefore useless. The OAuth 2.0 security best practice now recommends PKCE for all clients, including confidential ones.

What are OIDC scopes and claims?

Scopes are values in the authorization request that say what the app wants. The openid scope is the trigger: including it tells the provider to run OIDC and return an ID token. Without it, you get plain OAuth 2.0.

  • openid: required. Requests an ID token and runs OIDC.
  • profile: requests name, picture, and other profile claims.
  • email: requests the user's email address and whether it is verified.
  • address: requests the user's address.
  • phone: requests the user's phone number and whether it is verified.
  • offline_access: requests a refresh token so the app can get new access tokens later.

Claims are the name-value pairs inside the ID token and the UserInfo response. Standard claims include sub, name, given_name, family_name, email, email_verified, and picture. The provider only returns claims the user consented to share, and apps should request the minimum they need.

OIDC vs SAML: which should you use?

SAML is an XML-based federation technology used in many enterprise and academic settings. OIDC can satisfy the same use cases with a simpler, JSON and REST-based protocol, and it was designed to support native and mobile apps, whereas SAML was designed only for web apps.

Choose OIDC for new consumer apps, mobile apps, single-page apps, and any project where you want "Sign in with" buttons. Choose SAML when you must integrate with an existing enterprise identity setup that only speaks SAML, or when a customer or regulator requires it. Many organizations run both, and the two protocols are likely to coexist for a long time.

If you are building the app, OIDC is usually the easier choice: JSON tokens are easier to debug than XML assertions, libraries exist for every major language, and the discovery document at /.well-known/openid-configuration tells your app everything it needs about a provider automatically.

Three tokens, three jobs — do not mix them upID tokenSigned JWTWho is the user?Use: authenticationAccess tokenOpaque or JWTWhat may the app do?Use: API callsRefresh tokenLong-lived secretGet new tokens laterUse: renewal onlyAn ID token proves identity. An access token proves permission.Validate the ID token signature, issuer, audience and expiry every time.
ID, access, and refresh tokens each have one job. Illustration by Cysoro.

What are the common OIDC security mistakes?

OIDC is safe when implemented carefully, and dangerous when its checks are skipped. These are the mistakes that appear most often in real breaches and audits.

  • Not validating the ID token: accepting any JWT without checking its signature, issuer, audience, and expiry. An attacker can forge a token that looks right.
  • Skipping the nonce check: the nonce ties the ID token to this login attempt. Without it, a captured token can be replayed.
  • Using the implicit flow: tokens in the browser URL leak. Use the authorization code flow with PKCE.
  • Trusting the access token for identity: access tokens are for APIs, not for proving who the user is.
  • Requesting too many scopes: asking for profile, email, address, and offline access when you only need an email address. Users notice, and consent rates fall.
  • Storing tokens in local storage: JavaScript can read local storage, so a cross-site scripting flaw exposes your tokens. Prefer secure, HTTP-only cookies for session state.
  • Not checking token expiry: treating an expired ID token as valid, or using a refresh token forever without rotation.

Use a maintained OIDC library for your language rather than hand-rolling token validation. The libraries handle signature verification, discovery, and nonce checks for you, and they are updated when the specification or best practice changes.

Who uses OpenID Connect?

Almost every large consumer service uses OIDC. Google, Microsoft, Apple, Facebook, Amazon, GitHub, and many others act as OpenID Providers, and millions of apps rely on them for sign-in. In enterprise settings, providers such as Microsoft Entra ID, Okta, and Auth0 use OIDC for workforce single sign-on.

For small businesses, OIDC usually arrives ready-made: your Google Workspace or Microsoft 365 account is already an identity provider, and the apps you buy support "Sign in with Google" or "Sign in with Microsoft" out of the box. Enabling single sign-on through OIDC, plus phishing-resistant MFA on the provider, is one of the highest-value security steps a small team can take.

Our guide to what DMARC is covers a related identity problem — proving that an email really came from your domain.

Our small business cybersecurity checklist puts SSO and MFA in context with the other controls that matter most.

The bottom line

OpenID Connect is the identity layer on top of OAuth 2.0. It lets an app ask a trusted provider who you are, and receive a signed ID token as the answer, without ever handling your password.

If you are choosing a login method, use OIDC with the authorization code flow and PKCE, validate the ID token every time, and request only the scopes you need. You can inspect a real ID token yourself with our free JWT decoder — paste a token in and see the claims inside it.

Frequently asked questions

What is OpenID Connect in simple terms?

OpenID Connect is a standard way for an app to ask a trusted provider, such as Google or Microsoft, to confirm who you are. You sign in once with the provider, and the provider gives the app a signed token proving your identity, so the app never sees your password.

What is the difference between OAuth 2.0 and OpenID Connect?

OAuth 2.0 is for authorization: it lets an app access your data on another service with your permission. OpenID Connect adds authentication on top of OAuth 2.0: it proves who you are, using an ID token. OAuth answers what an app may do, OIDC answers who the user is.

What is an ID token?

An ID token is a signed JSON Web Token issued by the identity provider after you sign in. It contains claims such as the issuer, the user identifier, the audience, and the expiry time, and the app verifies the signature before trusting it.

Is OpenID Connect the same as SAML?

No. Both provide single sign-on, but SAML is an older XML-based protocol used mainly in enterprise and academic settings, while OpenID Connect is a newer JSON and REST-based protocol built on OAuth 2.0 that also works well for mobile and single-page apps.

What is the authorization code flow?

It is the recommended OIDC flow. The app redirects you to the identity provider, you sign in, and the provider returns a short-lived authorization code. The app then exchanges that code, with its client secret or PKCE verifier, for ID and access tokens on a back channel.

What is PKCE in OpenID Connect?

PKCE, pronounced pixy, is an extension that protects the authorization code flow. The app creates a random secret before redirecting you, and must present the same secret when exchanging the code for tokens, so a stolen code alone is useless.

Do I need a password if I use OpenID Connect?

You still have a password, but only with your identity provider, not with every app you use. Each app trusts the provider to check it. That reduces the number of passwords you manage and the number of places that can leak them.

Is "Sign in with Google" OpenID Connect?

Yes. Google, Microsoft, Apple, and many other providers implement OpenID Connect. When you click Sign in with Google, the app is using OIDC to get an ID token from Google that proves you signed in.

Sources

  1. OpenID Foundation — How OpenID Connect Works
  2. Microsoft Security — What is OpenID Connect (OIDC)?
  3. OpenID Foundation — OpenID Connect Core 1.0
  4. IETF — RFC 6749: The OAuth 2.0 Authorization Framework
  5. IETF — RFC 7519: JSON Web Token (JWT)
Written & fact-checked byCysoro Security Team

The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.

  • Email authentication
  • Phishing & BEC
  • Domain & DNS security
  • Small-business security

Checked against the OpenID Foundation's How OpenID Connect Works page, the OpenID Connect Core 1.0 specification, and RFCs 6749 and 7519.

How we write and fact-check →

Free tools for this topic

No account needed.

See where your domain stands

Free for up to 3 domains. No card, no installs.

Start free