What is Ory Hydra?
I’m trying to look for something to protect your API that contains permission given by your users. I’ve found the thing that calls OAuth 2.0. It is difficult to understand the first time. Because when I try to google find a lot of information and sometimes it conflict and lets you misunderstand the real concept.
Until I’ve found this guy to make me clear about OAuth
However, I still need to find a way to have an OAuth server. Firstly, I looking at Auth0 and OKta to see How it works. So luckily my friend introduces me to Ory/Hydra.
Ory Hydra - Open Source OAuth 2.0 and OpenID Connect Server
Open Source OAuth 2.0 and OpenID Connect Server - gethydra.sh.
What is Hydra?
Hydra is an OAuth 2.0 and OpenID Connect Provider. In other words, an implementation of the OAuth 2.0 Authorization Framework as well as the OpenID Connect Core 1.0 framework. As such, it issues OAuth 2.0 Access, Refresh, and ID Tokens that enable third parties to access your APIs in the name of your users.
The benefit of this project it allows the setup of an OAuth server separate from the Authentication service. In case you already have an Authentication system. It is different from awesome projects like Laravel passport that have complete OAuth server include authentication system in the same place.
Hydra support container :D
It is so really easy to set up Hydra with a docker image. You can be running the OAuth server in 5 minutes.
Hydra allows you to integrate your existing application to your OAuth server with SDK or make a request directly to API. Unfortunately, if you want to use SDK because it requires old packages. In my case, I want to use Laravel 9 which requires Guzzlehttp 7.0+, but SDK requires 6.0 because SDK has been generated from OpenAPI generator need maintainer to understand how to use it.
Sometimes we might want any packages that have less code and are compatible with Laravel. I decided to create an unofficial package instead of maintaining an existing one.
GitHub - ALTELMA/laravel-hydra: Ory Hydra Client API for PHP that support Laravel
Laravel Hydra is a package that provides Client API for Hydra support Laravel and following the newest of PHP version…
This package provides an API Client for Hydra support Laravel. The next steps will add compatibility with Lumen, too.
Ory Hydra is an awesome project, but still lack of documentation and need to take time to understand for How it works? Fee free to comments to your idea