Member-only story
Use the Source: Ory/Hydra
Hydra (https://github.com/ory/hydra) is an open-source, cloud native implementation of Oauth2. BTW, if you want to refresh your memory of Oauth2 or get a deeper understand of its code flow, I have a companion blog post (Oauth2 Deep Dive [link])that may help.
Hydra orchestrates the Oauth2 flows to authenticate the apps and authorize access based on user consent. Enterprises can plug in their identity providers and consent systems with Hydra to create an end to end Oauth2 signon experience, similar to that of Google or Facebook.
Hydra is commonly packaged in docker and deployed in container clusters. But in our “use the source” series, we focus on reading the source code to learning the design and implementation of the software. So putting the deployment strategy aside, Hydra is a Golang-written binary that can be invoked via command-line. The key commands are hydra clients | keys | serve| token
. There are a few other helper commands such as hydra migrate sql
, hydra token client
, hydra token flush | revoke
, and hydra version
. Don’t worry if those don’t make sense to you now, we’ll get into some of them later in this post and the rest don’t matter that much in this “use the source” series.
Input
The first point of interest is how the commands are organized in the code. We’ve all had the unpleasant experience at some point in…