cognito-local icon indicating copy to clipboard operation
cognito-local copied to clipboard

feat(api): add support for oauth2 token endpoint

Open acwrenn opened this issue 2 years ago • 5 comments

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.

acwrenn avatar Feb 25 '23 17:02 acwrenn

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.

jagregory avatar May 28 '23 06:05 jagregory

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

CurlyDev1 avatar Mar 07 '24 16:03 CurlyDev1

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

acwrenn avatar Mar 07 '24 21:03 acwrenn