Implement M2M authentication using ory hydra#1803
Merged
thesocialdev merged 2 commits intostagefrom Feb 12, 2025
Merged
Conversation
* Introduce a new M2M guard that will check if the request comes from another machine using OAuth2 backed by Ory hydra * Refactor Guard logic and use a base guard to share utilities across guards * Introduce a new ability called "Integration" that will have the ability to create entities in the platform, in the future we want more granularity through a scope based authentication
|
Collaborator
|
the commands could not be carried out all at once I managed to do it this way |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Links #1801
Type of change
Testing
You will need to setup Ory Hydra locally, use the docker-compose setup to enable such infrastructure:
Setup with Docker
You will need to manually create an OAuth2 client and generate the tokens through the hydra CLI:
And to generate the tokens, get the client_id and client_secret that the command below provides:
Setup with Ory cloud
Create a new Client in the ory cloud console and follow the steps as following







Make sure you mark it to skip consent
Save your secret
With the info you can collect as demonstrated in the screenshots below, create a
.envfile insideory_config/test/and follow the steps in the README.md in the same folder. Your.envfile should look like:Run the script to get the token and use it for the authentication in the next step:
Authenticating with M2M tokens
In postman, pass the token as an authorization header:
Developer Checklist
General
console.logor related logging is added.Backend Changes
Tests
Merge Request Review Checklist