jagregory / cognito-local

Local emulator for Amazon Cognito
MIT License
289 stars 74 forks source link

feat(api): add support for oauth2 token endpoint #376

Open acwrenn opened 1 year ago

acwrenn commented 1 year ago

Cognito supports more features than just its AWS-API calls demonstrate. This service fake simulates just those AWS APIs - except for .well-known/jwks.json.

This PR starts to add support for the token endpoint outlined here: https://docs.aws.amazon.com/cognito/latest/developerguide/token-endpoint.html

However, since we are not serving static data, we need to create a fake target, and then add this to our AWS API Router, so that we can get access to the services objects.

Please give some feedback on the "not real AWS target method" - it seemed the best way to get the shared service objects to the inner handler.

BUILD NOTES:

  1. I could not get the project to build with the newer aws-lamba types - I had to pin those to the lowest minor version originally allowed. Guidance on this would be helpful, I don't generally work on TS projects.
  2. I also could not get the docker image to build without the yarn lock being present - I assumed this was a mistake, as requiring a local yarn before being able to build the docker image with the containerized yarn seemed unnecessary - but hopefully can get some more feedback.
jagregory commented 1 year ago

I've left a comment on the implementation, but otherwise I think this looks ok. I don't mind it being a bit hacky for these non-API routes, at least while there's only a couple of them. Let me know what you think.

The yarn and docker issues are odd though. There's a yarn.lock in the repo, so the docker image should (and does in GitHub Actions) build fine.

CurlyDev1 commented 7 months ago

Hi, this would be really useful to have locally :) was there a reason the PR was not merged ?

acwrenn commented 7 months ago

We have been using a local fork, but I would like to move off that eventually. But had forgotten about this!

mario-gazzara commented 3 weeks ago

When will be merged? I need it!