Is there a free OpenID Connect provider I can use for my app?
Short answer
Yes. Open-source servers like Keycloak, Zitadel, authentik, Ory Hydra, Dex and Authelia cost nothing to license, but you pay for the server and the upkeep. Hosted services such as Auth0, Zitadel Cloud, Logto Cloud, Kinde and Amazon Cognito have free tiers with limits, and mock servers cover local tests. loginos is a hosted OpenID Connect provider with no paid plans today.
You want people to sign in to your app through a standard protocol instead of a vendor SDK, and you don’t want to pay for it yet. Free OpenID Connect providers come in three forms: open-source servers you run yourself, free tiers of hosted services, and mock servers for development. Each costs something other than money, and the same client code works with all of them.
What is an OpenID Connect provider?
An OpenID Connect provider, also called an OpenID Provider (OP), is a server that signs people in and tells your app who they are in a signed ID token. OpenID Connect (OIDC) is the identity layer on top of OAuth 2.0. Your app sends the browser to the provider, gets a one-time code back, and exchanges it for tokens on the server.
Every OIDC provider can publish a discovery document at /.well-known/openid-configuration, as defined by OpenID Connect Discovery. The document lists the provider’s endpoints, signing keys and features, so a standard library configures itself from one URL. That is what makes providers interchangeable.
Which open-source OpenID Connect providers can you host for free?
These projects are free to download and run. They range from a full identity server to a thin layer in front of accounts you already have.
| Project | License | What it is | Fits when |
|---|---|---|---|
| Keycloak | Apache 2.0 | A full identity server: OIDC, OAuth 2.0, SAML 2.0, social login, brokering, LDAP | You want most features in one server |
| Zitadel | AGPL-3.0 | A certified OIDC provider with SAML 2.0, SCIM 2.0 and organizations | You sell to businesses with many customer organizations |
| authentik | MIT, enterprise features separate | An identity provider for OIDC, SAML, LDAP and RADIUS, plus a proxy | You protect many self-hosted apps, some without OIDC |
| Ory Hydra | Apache 2.0 | An OpenID Certified OAuth 2.0 and OIDC server without user management | You already have users and a login page |
| Dex | Apache 2.0 | A federated OIDC provider with connectors for LDAP, SAML 2.0, GitHub and Google; a CNCF Sandbox project | Your identities live elsewhere, as often in Kubernetes |
| Authelia | Apache 2.0 | A login portal with two-factor authentication and an OpenID Certified OIDC provider, in open beta | Your services sit behind a reverse proxy like Traefik or Caddy |
Other open-source options include Logto (MPL-2.0) with prebuilt sign-in flows, Kanidm (MPL-2.0), and Pocket ID (BSD-2-Clause), an OpenID Certified provider that signs people in with passkeys only.
What does a free self-hosted provider cost?
The software is free, but running it isn’t. A self-hosted OIDC provider needs:
- A server or container platform, a database, TLS certificates and backups.
- Upgrades and security patches. An identity server is an attractive target, so falling behind on releases is a real risk.
- Email delivery for verification codes and password resets.
- Monitoring and someone on call. When the provider is down, nobody can sign in to any app that uses it.
For a side project, that may be fine. For a business, it becomes part of somebody’s job.
Which hosted OpenID Connect providers have a free tier?
Most hosted identity services have a free tier. The limits differ by provider: monthly active users, number of apps, custom domains, MFA, log retention and support. Free tiers change, so check the current pricing page before you build on one.
| Provider | Free plan | Current limits |
|---|---|---|
| Auth0 | Free plan | Auth0 pricing |
| Zitadel Cloud | Free plan | Zitadel pricing |
| Logto Cloud | Free plan, no credit card | Logto pricing |
| Kinde | Free plan, no credit card | Kinde pricing |
| Amazon Cognito | Free tier on the Lite and Essentials plans | Cognito pricing |
| Microsoft Entra External ID | Free tier, then billed by monthly active users; needs an Azure subscription | External ID pricing |
A hosted free tier saves you the operations work, but your users live in the vendor’s system, and moving them later takes planning. Auth0 alternatives compares hosted services in more depth.
Can you run a mock OpenID Connect server for testing?
Yes. A mock server acts like a provider on your machine and signs real tokens, but it lets anyone sign in as anyone. Use one in development and automated tests, never in production.
navikt/mock-oauth2-server(MIT) runs in Docker and shows a login page where you type any username and claims. Its discovery URL ishttp://localhost:8080/default/.well-known/openid-configuration.oauth2-mock-server(MIT, on npm) starts from your test code. Its/authorizeendpoint redirects straight back without a login page, which suits automated tests.- Keycloak in development mode (
start-dev) gives you a full provider on your machine when a mock is too simple.
docker run -p 8080:8080 ghcr.io/navikt/mock-oauth2-server:6.0.7How do you connect your app to any OpenID Connect provider?
Use a certified OIDC library and give it the provider’s address. The library reads the discovery document, adds state and PKCE to the redirect, and checks the ID token. PKCE (Proof Key for Code Exchange) stops a stolen code from being used. The examples point at loginos; to switch providers, change the address and the credentials.
import * as client from "openid-client";
// Reads https://loginos.io/.well-known/openid-configuration.
const config = await client.discovery(
new URL("https://loginos.io"),
process.env.LOGINOS_APP_KEY,
process.env.LOGINOS_APP_SECRET,
);
const callbackPath = "/api/auth/login/single/callback";
app.get("/login", async (req, res) => {
const verifier = client.randomPKCECodeVerifier();
const state = client.randomState();
res.cookie("oidc", `${state}.${verifier}`, { httpOnly: true, secure: true, sameSite: "lax", maxAge: 600_000 });
const url = client.buildAuthorizationUrl(config, {
redirect_uri: `https://${req.get("host")}${callbackPath}`,
scope: "openid profile email",
code_challenge: await client.calculatePKCECodeChallenge(verifier),
code_challenge_method: "S256",
state,
});
res.redirect(url.href);
});
app.get(callbackPath, async (req, res) => {
const [state, verifier] = (req.cookies.oidc ?? "").split(".");
try {
const tokens = await client.authorizationCodeGrant(
config,
new URL(req.originalUrl, `https://${req.get("host")}`),
{ pkceCodeVerifier: verifier, expectedState: state },
);
req.session.user = tokens.claims(); // sub, name, email…
res.redirect("/");
} catch {
res.status(401).send("Sign-in failed.");
}
});openid-client is OpenID Certified for the Basic, FAPI 1.0 and FAPI 2.0 relying party profiles. Authlib’s Flask client keeps state, the nonce and the PKCE verifier in the session for you.
Where loginos fits
loginos is a hosted OpenID Connect provider at loginos.io. There is no server for you to run, loginos has no paid plans today, and you can start without a card.
loginos fits when:
- You want standard OIDC. Discovery is at
https://loginos.io/.well-known/openid-configuration, with the authorization code flow, PKCE (S256) and RS256 ID tokens, so the code above works unchanged. The OIDC reference lists every endpoint, claim and error. - Your app runs on several domains. All domains of a platform share one pool of people, with no limit on how many you add. See single sign-on across domains.
- You want passkeys without building them. Passkeys live on loginos.io and work on all your domains, and passwords still work.
- You need roles. Roles and permissions come in every token.
loginos doesn’t fit when you need self-hosting or open source, social logins, SAML, SMS or authenticator codes, organizations inside one product, or a login page on your own domain. Email addresses aren’t verified yet (email_verified is false), and there are no refresh tokens: access and ID tokens last one hour, and your app keeps its own session after sign-in.
To start, create an account, add a platform with your first domain in the developer console, and copy the app secret when it is shown. Put both credentials in your server’s environment, and use the code above with the callback https://<your domain>/api/auth/login/single/callback. The quickstart has complete examples for Next.js, Express and PHP.
Frequently asked questions
Is Keycloak free?
Yes. Keycloak is open source under the Apache 2.0 license and costs nothing to download and run. You still pay for the servers, and for the time to upgrade, back up and secure it. If running it is more than you want, see simpler alternatives to Keycloak.
What is the difference between OpenID Connect and OAuth 2.0?
OAuth 2.0 lets an app get an access token to call an API on someone’s behalf, but it doesn’t say who that person is. OpenID Connect adds an ID token, standard claims like sub, name and email, a userinfo endpoint and discovery, so your app learns who signed in.
Can I use Google as my OpenID Connect provider?
Yes, for people with Google accounts. Google’s OpenID Connect endpoint is OpenID Certified, with discovery at https://accounts.google.com/.well-known/openid-configuration. It only signs in people who have a Google account, so most apps offer it next to other ways to sign in.
Does a hosted provider lock me in?
Less than you might think, if it speaks standard OIDC. Your app depends on the discovery URL, the token endpoint and the ID token, so switching providers is mostly configuration. The hard part is the accounts: passwords, passkeys and user ids. Keep your own user id as the key, and store each provider’s sub next to it.
One account for every domain you run
loginos is an OpenID Connect provider with passkeys, a user pool shared by all of your domains, roles in every token, and account linking for the users you already have. Add your platform and its domains in a few minutes.
Keep reading
- Choosing a providerIs there something simpler than Keycloak?Yes. Keycloak does almost everything, but you run, upgrade and theme it yourself. Simpler self-hosted options include Zitadel, Logto and Casdoor for a full identity provider, Authelia for apps behind a reverse proxy, and Dex for bridging existing directories to OpenID Connect. If you don’t want to run anything, a hosted provider or managed Keycloak removes the operations work, and loginos is a hosted option for apps on many domains.7 min read
- Choosing a providerWhat is a good alternative to Auth0?Good Auth0 alternatives include hosted services like Clerk, WorkOS AuthKit, Stytch, Descope and Kinde, and open-source servers you run yourself, like Keycloak, Zitadel, authentik, Ory and Logto. Firebase, Supabase and Amazon Cognito bundle sign-in with their platforms, and Auth.js or Better Auth keep it in your code. Choose by who runs it and how you would leave. loginos fits products on many domains.7 min read
- Choosing a providerWhat is a cheaper alternative to Clerk?Cheaper alternatives to Clerk are open-source libraries like Auth.js and Better Auth, self-hosted servers like Keycloak, Zitadel or Logto, and the sign-in that comes with Supabase, Firebase or Amazon Cognito. Each saves money by giving something up: Clerk’s prebuilt components, its hosted dashboard, or your team’s time. loginos is a hosted OpenID Connect provider with no paid plans today.6 min read
- Sign-in across domainsHow do I implement single sign-on across different domains?Use one OpenID Connect provider for all of your domains, and register each domain’s callback URL with it. On every domain, add a route that redirects to the provider with state and PKCE, and a callback that checks state, exchanges the code on your server and starts that domain’s own session. People signed in on one domain then pass through the others without a form.8 min read