Quickstart 走的是 Ory Network 托管服务,自托管需另行参考文档部署;需自行实现 login 与 consent 应用,Hydra 本身不含用户管理;示例命令依赖 Ory CLI,需先安装并登录
hydra
oryApache-2.0活跃维护开箱即用的 OpenID Connect 和 OAuth2.1 授权服务器,通过无头 API 对接你自己的用户系统,快速实现登录授权与单点登录场景。
Internet-scale OpenID Certified™ OpenID Connect and OAuth2.1 provider that integrates with your user management through headless APIs. Solve OIDC/OAuth2 user cases over night. Consume as a service on Ory Network or self-host. Trusted by OpenAI and many others for scale and security. Written in Go.
bash <(curl https://raw.githubusercontent.com/ory/meta/master/install.sh) -b . ory
sudo mv ./ory /usr/local/bin/
ory auth
ory create project --create-workspace "Ory Open Source" --name "GitHub Quickstart" --use-projectREADME 未说明
OpenID 认证的 OAuth2/OIDC 服务端,无头 API 对接你现有用户体系
开箱即用的 OpenID Connect 和 OAuth2.1 授权服务器,通过无头 API 对接你自己的用户系统,快速实现登录授权与单点登录场景。
核心能力
- 实现 OAuth2.0 与 OpenID Connect Core 1.0 全套流程
- 通过 login/consent app 对接任意已有身份提供方
- 负责令牌签发、校验、撤销与内省
- 支持动态客户端注册与 JWKS 管理
- 低延迟高吞吐,适配 Kubernetes 等云原生环境
容易踩的坑
- v26.2.0最新正式版2026-03-20 · 2026-03-20 13:23 UTC
v26.2.0
Bug Fixes
-
Always retry curl invocations to surmount transient third-party failures (c28a6c8):
-
Broken older down migrations (8ed407d):
-
Context passing and limit response size (f33d6a8):
-
Context passing in jsonnetsecure (5884774):
-
Correctly detect when to use self-signed certificates (6f9af27):
-
Correctly scan SQL
NULLinto go JSON types (163c579): -
Data race in hydra-oss test (262f85b):
-
deps: Update dependency prettier to v3.7.4 (106865d):
-
Do not cache pairwise subject algorithm (a341867):
-
Down migrations in newer MySQL versions (5b0360d):
-
Fix benchmark test (d0e0659):
-
Flaky tests on hydra-oss tests (ce58946):
-
Incorrect default value for page_tokens (f1290da):
-
Incorrect usage of database/sql (a8142d0):
-
Properly validate policy URI on client creation (44347e7):
-
Remove flaky test for unused function (e8c8803):
-
Remove WithDumpMigrations option to MigrationBox (6fd8a64):
-
Request log config key (11ad1ac):
-
Stray debug print (f6b28db):
-
Transactions managed by fosite were not working (3ad64db):
-
Update CONTRIBUTING.md (0c78aa7):
-
Update go modules (845cc4d):
-
Update packages to fix GHSA-7h2j-956f-4vf2 (ae75488):
-
Upgrade vulnerable dependencies across Go and npm (f28904c):
Co-authored-by: Deepak Prabhakara [email protected]
-
X data race and parallize some tests (d37af61):
Code Generation
- Prepare for OSS release - v26.2.0 (0b84568):
Code Refactoring
- Squash merge old backoffice migration and fix up command (9d96bbd):
Documentation
- Update readmes (8daeebb):
Features
-
Add ratelimit buckets to swagger definitions (1819465):
-
Add support
-
- v25.4.02025-11-07 · 2025-11-07 14:57 UTC
查看更新说明
v25.4.0 brings first-class support for agentic authorization with the Device Authorization Grant (RFC 8628) and OAuth 2.1 discovery endpoint, making it easier for agents, IoT devices, and headless clients to obtain and manage access securely. Combined with new consent-chain revocation and migration fixes for CockroachDB v25+, Hydra v25.4 strengthens its role as the web and AI scale-ready OAuth 2.1 and OpenID Connect server for modern applications.
Ory has moved to a new versioning scheme. Read about our new version scheme. Interested in self-hosting Ory with support, SLAs, and advanced features? Check out our offerings.
Highlights
Agentic authentication use cases
This release makes Ory Hydra a stronger foundation for agentic authentication, where autonomous agents or constrained devices need to obtain and manage access without a full browser or direct human interaction. Two key updates enable this:
- Device authorization grant (RFC 8628): Essential for headless or limited-input clients (e.g., smart TVs, IoT devices, AI agents). It allows users to securely authorize agents through a secondary device, solving a common gap in agentic workflows.
- OAuth 2.1 discovery endpoint: Hydra now serves both OpenID Connect and OAuth 2.1 discovery documents, aligning with emerging standards. This simplifies integration for agents that expect OAuth 2.1 metadata and removes friction in federated or automated flows.
Together, these features address longstanding issues for agentic use cases by combining standards compliance with Hydra’s production-grade session and consent handling.
Device authorization grant (RFC 8628)
Adds full device flow support for devices without a browser or with limited input (smart TVs, consoles, agents).
Revoke token chains by consent challenge ID
New capability to revoke the entire token chain (refresh token and all derived access tokens) produced by a specific consent session.
OAuth 2.1 discovery endpoint
Hydra now serves
/.well-known/oauth-authorization-serverin addition to/.well-known/openid-configurationto aid OAuth 2.1 and certain integrations (per RFC 8414).Improvements
- Lower latency when revoking linked Kratos sessions by making revocation asynchronous.
- Client updates with JWKS URI: PATCH/PUT no longer blocked when
json_web_keys_uriis set (andjson_web_keyspresent). - JWT query performance: added an index for faster JWT-related lookups.
- CLI: clearer usage/help examples.
Fixes
- CockroachDB v25+ migrations: corrected/updated migration scripts; includes device-flow down/auto-commit fixes.
- Postgres UUIDs: use
uuid_generate_v4()instead of MD5-based generation (enable theuuid-osspextension if not already). - Case-insensitive
user_codescrubbing in device flow. - Validation:
tos_urivalidation corrected. - Docs: fixed JWT access token documentation link.
Security and dependencies
- go-jose v3.0.4 with a backport for CVE-2025-27144.
- Go toolchain upgrades (1.24.x) and crypto stack updates (e.g.,
ThalesGroup/crypto11,circl) addressing advisories. - General dependency hygiene and CI hardening.
Upgrade notes
- Run migrations before rolling out v2.4.0.
- CockroachDB users on v25+: this release includes specific migration fixes; ensure your migration runner picks up the updated scripts.
- Postgres users: ensure
uuid-osspis enabled (CREATE EXTENSION IF NOT EXISTS "uuid-ossp";) to support native UUIDs.
- Device flow UI: add the two required screens/routes in your login/consent app to use RFC 8628.
- Monitoring: if you scrape Prometheus on public endpoints, expect additional metrics.
Auto-generated release notes
Bug Fixes
- Add repo syn
- v2.3.02025-01-17 · 2025-01-17 08:51 UTC
查看更新说明
We’re thrilled to announce the release of Ory Hydra 2.3.0! This version comes packed with graceful token refresh, performance improvements, and fixes that enhance stability, reduce database load, and streamline the developer experience. We strongly recommend upgrading to take advantage of these enhancements and ensure the best possible OAuth2 and OpenID Connect experience with Ory Hydra. Thank you to everyone who contributed!
Ory Hydra now supports graceful refresh token rotation, making OAuth2 and OpenID Connect refresh flows significantly more resilient in scenarios such as Single Page Apps and IoT. Even in highly distributed or concurrent environments, Hydra gracefully handles token refreshes reliably, ensuring tokens are not dropped or double-used.
Previously, the
redirect_uriwas not required when performing flows withscope=openid. This release enforces the requirement to comply with the OpenID Connect standard.PR: #3900
Hydra now supports explicit SQL migration commands
migrate sql up|down|statusthat streamline database schema management and help with zero-downtime upgrades.PR: #3894
- Access token strategy & advanced CLI improvements The CLI introduces new parameters and an option to specify a custom client ID on creation, making it easier to manage and script Hydra deployments. PRs: #3718, #3725, #3874
- Built-in login & consent UI for
hydra perform authorization-codeA minimal built-in UI for login and consent can be enabled when testing with the CLI, removing the need to spin up a separate service. PR: #3845
Unused indices have been removed, down migration scripts renamed for consistency, and all migrations are more efficient overall.
-
Improve persistence logic – Database transactions and concurrency have been improved across the authorization and token handlers. PRs: #3756, #3763, #3886
-
Support for more claims in password grant – You can now include additional claims in the password grant flow, providing extra flexibility in advanced scenarios. Only available with an Ory Enterprise License. PR: #3864
-
Transaction Wrappers Authorization and token issuance are now wrapped more consistently to prevent partial writes and race conditions. PRs: #3730, #3763
-
Improved Docker setup Docker configurations have been refined, removing inconsistencies in the Compose setup and enabling a fully static binary build. PRs: #3826, #3924
-
Proper JSON round-tripping Fixed an issue causing custom claims to break if they were nested or unexpectedly typed. JSON round-trips are now correct. PR: #3819
-
Speed up public key retrieval Reduced overhead for the JWK public endpoint, solving CPU contention issues in large-scale deployments. PRs: #3787, #3870
-
Fix Docker Compose references The CLI now properly references
docker composeinstead ofdocker-compose, ensuring compatibility with modern Docker setups. PR: #3815 -
Dependency upgrades
- v2.2.02024-02-12 · 2024-02-12 11:37 UTC
查看更新说明

Ory Hydra, the OAuth2 and OpenID Connect server designed for web-scale deployments introduces over 6x higher OAuth2 throughput on a single PostgreSQL instance!
Want to check out Ory Hydra yourself? Try common OAuth2 flows in the Ory OAuth2 Get Started guide!
This version significantly enhances performance, processing over 6x more authorization flows than version 2.1, thanks to architectural improvements that minimize database interactions for login and consent processes.
Key improvements include:
- Enhanced integration with Ory Kratos, ensuring seamless synchronization of login and logout states across both services. Users logged out from Ory Hydra will automatically log out from Ory Kratos, enhancing security and user experience.
- The ability to bypass the logout consent screen for specific clients, streamlining the logout process.
- Simplified migration with the new feature to import OAuth2 Client IDs, making the transition to Ory Hydra smoother.
- Support for the OIDC Verifiable Credentials specification, expanding the server's capabilities in identity verification.
Thank all contributors who have made this release available!
Bug Fixes
-
Return empty slice if requested_scope or audience is null (#3711) (65165e7)
-
Correct id token type in token exchange response (#3625) (d1f9ba8):
-
Handle subject mismatch gracefully (#3619) (af0d477):
We now redirect to the original request URL if the subjects between the remembered Hydra session and what was confirmed by the login screen does not match.
-
Handle token hook auth config (#3677) (1a40833):
- fix: handle token hook auth config
- fix: bump golangci-lint
-
Incorrect down migration (#3708) (8812e0e), closes /github.com/ory/hydra/pull/3705#discussion_r1471514014
-
Timeout in jwt-bearer grants when too many grants are available (#3692) (a748797)
-
Add kid to verifiable crede
- v2.2.0-rc.3pre-release2023-08-16 · 2023-08-16 21:09 UTC
查看更新说明
Introduces logout compatibility with Ory Kratos.
Bug Fixes
- Add exceptions for internal IP addresses (#3608) (1f1121c)
- Add kid to verifiable credential header (#3606) (9f1c8d1)
- Deflake ttl test (6741a49)
- Docker build (#3609) (01ff9da)
- Enable CORS with hot-reloaded origins (#3601) (6f592fc)
- Only query access tokens by hashed signature (a21e945)
- Racy random string generation (#3555) (1b26c4c)
- Reject invalid JWKS in client configuration / dependency cleanup and bump (#3603) (1d73d83)
- Restore ability to override auth and token urls for exemplary app (#3590) (dfb129a)
- Return proper error when the grant request cannot be parsed (#3558) (26f2d34)
- Use correct tracer in middleware (#3567) (807cbd2)
Code Generation
- Pin v2.2.0-rc.3 release commit (ad8a4ba)
Features
-
Add more resolution to events and collect client metrics (#3568) (466e66b)
-
Add state override (b8b9154)
-
Add support for OIDC VC (#3575) (219a7c0):
This adds initial support for issuing verifiable credentials as specified in https://openid.net/specs/openid-connect-userinfo-vc-1_0.html.
Because the spec is still in draft, public identifiers are suffixed with
draft_00. -
Allow to disable claim mirroring (#3563) (c72a316):
This PR introduces another config option called
oauth2:mirror_top_level_claimswhich may be used to disable the mirroring of custom claims into theextclaim of the jwt. This new config option is an opt-in. If unused the behavior remains as-is to ensure backwards compatibility.Example:
oauth2: allowed_top_level_claims: - test_claim mirror_top_level_claims: false # -> this will pr
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Ory Hydra is a hardened, OpenID Certified OAuth 2.0 Server and OpenID Connect Provider optimized for low-latency, high throughput, and low resource consumption. It connects to your existing identity provider through a login and consent app, giving you absolute control over the user interface and experience.
- What is Ory Hydra?
- Deployment options
- Quickstart
- Who is using Ory Hydra
- Ecosystem
- Documentation
- Developing Ory Hydra
- Security
- Telemetry
- Libraries and third-party projects
What is Ory Hydra?
Ory Hydra is a server implementation of the OAuth 2.0 authorization framework and the OpenID Connect Core 1.0. It follows cloud architecture best practices and focuses on:
- OAuth 2.0 and OpenID Connect flows
- Token issuance and validation
- Client management
- Consent and login flow orchestration
- JWKS management
- Low latency and high throughput
We recommend starting with the Ory Hydra introduction docs to learn more about its architecture, feature set, and how it compares to other systems.
Why Ory Hydra
Ory Hydra is designed to:
- Be a standalone OAuth 2.0 and OpenID Connect server without user management
- Connect to any existing identity provider through a login and consent app
- Give you absolute control over the user interface and experience flows
- Work with any authentication endpoint: Ory Kratos, authboss, User Frosting, or your proprietary system
- Scale to large numbers of clients and tokens
- Fit into modern cloud native environments such as Kubernetes and managed platforms
OAuth2 and OpenID Connect: Open Standards
Ory Hydra implements Open Standards set by the IETF:
- The OAuth 2.0 Authorization Framework
- OAuth 2.0 Threat Model and Security Considerations
- OAuth 2.0 Token Revocation
- OAuth 2.0 Token Introspection
- OAuth 2.0 for Native Apps
- OAuth 2.0 Dynamic Client Registration Protocol
- OAuth 2.0 Dynamic Client Registration Management Protocol
- Proof Key for Code Exchange by OAuth Public Clients
- JSON Web Token (JWT) Profile for OAuth 2.0 Client Authentication and Authorization Grants
and the OpenID Foundation:
- OpenID Connect Core 1.0
- OpenID Connect Discovery 1.0
- OpenID Connect Dynamic Client Registration 1.0
- OpenID Connect Front-Channel Logout 1.0
- OpenID Connect Back-Channel Logout 1.0
OpenID Connect Certified
Ory Hydra is an OpenID Foundation certified OpenID Provider (OP).
The following OpenID profiles are certified:
- Basic OpenID Provider
(response types
code) - Implicit OpenID Provider
(response types
id_token,id_token+token) - Hybrid OpenID Provider
(response types
code+id_token,code+id_token+token,code+token) - OpenID Provider Publishing Configuration Information
- Dynamic OpenID Provider
To obtain certification, we deployed the reference user login and consent app (unmodified) and Ory Hydra v1.0.0.
Deployment options
You can run Ory Hydra in two main ways:
- As a managed service on the Ory Network
- As a self hosted service under your own control, with or without the Ory Enterprise License
Use Ory Hydra on the Ory Network
The Ory Network is the fastest way to use Ory services in production. Ory OAuth2 & OpenID Connect is powered by the open source Ory Hydra server and is API compatible.
The Ory Network provides:
- OAuth2 and OpenID Connect for single sign on, API access, and machine to machine authorization
- Identity and credential management that scales to billions of users and devices
- Registration, login, and account management flows for passkeys, biometrics, social login, SSO, and multi factor authentication
- Prebuilt login, registration, and account management pages and components
- Low latency permission checks based on the Zanzibar model with the Ory Permission Language
- GDPR friendly storage with data locality and compliance in mind
- Web based Ory Console and Ory CLI for administration and operations
- Cloud native APIs compatible with the open source servers
- Fair, usage based pricing
Sign up for a free developer account to get started.
Self-host Ory Hydra
You can run Ory Hydra yourself for full control over infrastructure, deployment, and customization.
The install guide explains how to:
- Install Hydra on Linux, macOS, Windows, and Docker
- Configure databases such as PostgreSQL, MySQL, and CockroachDB
- Deploy to Kubernetes and other orchestration systems
- Build Hydra from source
This guide uses the open source distribution to get you started without license requirements. It is a great fit for individuals, researchers, hackers, and companies that want to experiment, prototype, or run unimportant workloads without SLAs. You get the full core engine, and you are free to inspect, extend, and build it from source.
If you run Hydra as part of a business-critical system, for example OAuth2 and OpenID Connect for all your users, you should use a commercial agreement to reduce operational and security risk. The Ory Enterprise License (OEL) layers on top of self-hosted Hydra and provides:
- Additional enterprise features that are not available in the open source version
- Regular security releases, including CVE patches, with service level agreements
- Support for advanced scaling, multi-tenancy, and complex deployments
- Premium support options with SLAs, direct access to engineers, and onboarding help
- Access to a private Docker registry with frequent and vetted, up-to-date enterprise builds
For guaranteed CVE fixes, current enterprise builds, advanced features, and support in production, you need a valid Ory Enterprise License and access to the Ory Enterprise Docker registry. To learn more, contact the Ory team.
Quickstart
Install the Ory CLI and create a new project to try Ory OAuth2 & OpenID Connect.
# Install the Ory CLI if you do not have it yet:
bash <(curl https://raw.githubusercontent.com/ory/meta/master/install.sh) -b . ory
sudo mv ./ory /usr/local/bin/
# Sign in or sign up
ory auth
# Create a new project
ory create project --create-workspace "Ory Open Source" --name "GitHub Quickstart" --use-project
Try out the OAuth 2.0 Client Credentials flow:
ory create oauth2-client \
--name "Client Credentials Demo" \
--grant-type client_credentials
# Note the client ID and secret from output
ory perform client-credentials \
--client-id <your-client-id> \
--client-secret <your-client-secret>
# Note the access token from output
ory introspect token <your-access-token>
Try out the OAuth 2.0 Authorize Code + OpenID Connect flow:
ory create oauth2-client \
--name "Authorize Code with OpenID Connect Demo" \
--grant-type authorization_code,refresh_token \
--response-type code \
--redirect-uri http://127.0.0.1:4446/callback
ory perform authorization-code \
--client-id <your-client-id> \
--client-secret <your-client-secret>
Who is using Ory Hydra
The Ory community stands on the shoulders of individuals, companies, and maintainers. The Ory team thanks everyone involved - from submitting bug reports and feature requests, to contributing patches and documentation. The Ory community counts more than 50.000 members and is growing. The Ory stack protects 7.000.000.000+ API requests every day across thousands of companies. None of this would have been possible without each and everyone of you!
The following list represents companies that have accompanied us along the way and that have made outstanding contributions to our ecosystem. If you think that your company deserves a spot here, reach out to [email protected] now!
Many thanks to all individual contributors
Ecosystem
We build Ory on several guiding principles when it comes to our architecture design:
- Minimal dependencies
- Runs everywhere
- Scales without effort
- Minimize room for human and network errors
Ory's architecture is designed to run best on a Container Orchestration system such as Kubernetes, CloudFoundry, OpenShift, and similar projects. Binaries are small (5-15MB) and available for all popular processor types (ARM, AMD64, i386) and operating systems (FreeBSD, Linux, macOS, Windows) without system dependencies (Java, Node, Ruby, libxml, ...).
Ory Kratos: Identity and User Infrastructure and Management
Ory Kratos is an API-first Identity and User Management system that is built according to cloud architecture best practices. It implements core use cases that almost every software application needs to deal with: Self-service Login and Registration, Multi-Factor Authentication (MFA/2FA), Account Recovery and Verification, Profile, and Account Management.
Ory Hydra: OAuth2 & OpenID Connect Server
Ory Hydra is an OpenID Certified™ OAuth2 and OpenID Connect Provider which easily connects to any existing identity system by writing a tiny "bridge" application. It gives absolute control over the user interface and user experience flows.
Ory Oathkeeper: Identity & Access Proxy
Ory Oathkeeper is a BeyondCorp/Zero Trust
Identity & Access Proxy (IAP) with configurable authentication, authorization,
and request mutation rules for your web services: Authenticate JWT, Access
Tokens, API Keys, mTLS; Check if the contained subject is allowed to perform the
request; Encode resulting content into custom headers (X-User-ID), JSON Web
Tokens and more!
Ory Keto: Access Control Policies as a Server
Ory Keto is a policy decision point. It uses a set of access control policies, similar to AWS IAM Policies, in order to determine whether a subject (user, application, service, car, ...) is authorized to perform a certain action on a resource.
Documentation
The full Ory Hydra documentation is available at www.ory.com/docs/hydra, including:
- Installation guides
- Configuration reference
- HTTP API documentation
- Security architecture
- Performance benchmarks
For upgrading and changelogs, check releases tab and CHANGELOG.md.
Developing Ory Hydra
See DEVELOP.md for information on:
- Contribution guidelines
- Prerequisites
- Install from source
- Running tests
- Build Docker image
- Preview API documentation
Security
OAuth2 and OAuth2 related specifications are over 400 written pages. Implementing OAuth2 is easy, getting it right is hard. Ory Hydra is trusted by companies all around the world, has a vibrant community and faces millions of requests in production each day. Read the security guide for more details on cryptography and security concepts.
Disclosing vulnerabilities
If you think you found a security vulnerability, please refrain from posting it publicly on the forums, the chat, or GitHub. You can find all info for responsible disclosure in our security.txt.
Telemetry
Our services collect summarized, anonymized data that can optionally be turned off. Click here to learn more.
Libraries and third-party projects
Official:
Community:
Developer Blog:
- Visit the Ory Blog for guides, tutorials and articles around Ory Hydra and the Ory ecosystem.