Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a mix task to easily generate JWT tokens #6

Merged
merged 2 commits into from
Jul 20, 2024

Conversation

achouippe
Copy link
Contributor

By using authentication settings defined in the neurow configuration, this mix task prints JWT tokens on the standard output that are accepted by the public and internal APIs,

Public API

Generate tokens for the public API:

mix generate_jwt_token --api=public --issuer=test_issuer1 --topic=user:1234

Then to subscribe to the public api with curl:

curl http://localhost:4000/v1/subscribe -H "Authorization: Bearer <token>"

Internal API

Generate tokens for the internal API:

mix generate_jwt_token --api=internal --issuer=test_issuer1

Then, to publish messages on the internal api with curl:

curl http://localhost:3000/v1/publish -H "Content-Type: application/json" -X POST -d '{"message": "Hello world!" , "topic": "user:1234"}' -H "Authorization: Bearer  <token>"

@achouippe achouippe marked this pull request as ready for review July 19, 2024 17:07
@achouippe achouippe requested a review from bpaquet as a code owner July 19, 2024 17:07
@bpaquet bpaquet merged commit 8a3f4e5 into main Jul 20, 2024
3 checks passed
@bpaquet bpaquet deleted the jwt_generation_mix_task branch July 20, 2024 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants