Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oauth2 with ORY Hydra or ORY Kratos

I have a project that needs to implement Oauth2 (users need to be able to login with Google or iCloud), and I decided to use ORY hydra so I don't have to write my own Oauth2 implementation.

I tried figuring ORY Hydra out on my own, but I failed. I know how Oauth2 works in abstract terms, but I have no idea how to implement Oauth2 with it in practice. SDKs have no documentation, no matter what language they are for. I know that Hydra has an HTTP API, so language SDKs don't really matter, but I was hoping to find some guidance in their documentation; as I wrote, they have none. And the main documentation's "5 minute tutorial" just provides some docker containers without any code or logic behind them, just some docker-compose commands.

What is a good educational resouce that would show how to implement Oauth2 with ORY Hydra? At this point I am ready to use any language at all, or dive straight into the Oauth2 standard.

like image 374
selamba Avatar asked Dec 22 '20 10:12

selamba


People also ask

Who uses Ory Kratos?

3 companies reportedly use ORY Kratos in their tech stacks, including BulutArti, Paradromix, and Padis.

What is Ory Hydra?

Ory Hydra is a Certified OpenID Connect Provider Server and implements all the requirements stated by the OpenID Foundation. In particular, it implements the various OAuth 2.0 and OpenID Connect flows specified by the IETF and OpenID Foundation.

Should I use OAuth2 for my API?

Its really good in building API based request. For your question: If you are building just a basic API, with simple GET and POST requests, then you might want to ask yourself if the data that you are displaying or manipulating requires "security". If not then most likely, you don't need to implement OAuth.

What protocol does OAuth2 use?

OAuth 2.0 is an authorization protocol and NOT an authentication protocol. As such, it is designed primarily as a means of granting access to a set of resources, for example, remote APIs or user's data. OAuth 2.0 uses Access Tokens.


2 Answers

You need Ory Hydra if you want to become a OAuth2 provider yourself. What you are looking for is Ory Kratos, a user management system. You can also implement "Login with..." for multiple providers.

Check out this article for more info if you need OAuth2:

The "5 minute tutorial" does not really touch any underlying concepts, but there are multiple links to the docs that explain this. Here is a good starting point: https://www.ory.sh/hydra/docs/concepts/oauth2

like image 164
vinckr Avatar answered Oct 21 '22 15:10

vinckr


For "social sign-in" you probably need Kratos: https://www.ory.sh/kratos/docs/concepts/credentials/openid-connect-oidc-oauth2/

like image 45
Seweryn Niemiec Avatar answered Oct 21 '22 15:10

Seweryn Niemiec