Need an ability to use Cognito across regions. I managed to replicate cognito directory across regions using dynamodb and global tables. This creates multiple problems, including an issue that a token is not valid across regions. This requires use to login particular region in order to access resources in that region. I need a solution to this, so that user can log in once and use the same token to access resources across regions. I’m using API Gateway/Lambdas. I’m comfortable writing custom Authorizer for APIGateway as long as the request does not go across regions every time. I’m also ok with a non AWS solution for this. Thanks!
I’m looking to Auth0 custom aws authorizer and I’m bit confused (https://github.com/auth0-samples/jwt-rsa-aws-custom-authorizer/blob/master/lib.js). Authorizer run in lambda, which is basically stateless. But they’re trying to use LRU cache in order to not to go remote to fetch keys. How can it work if Lambdas are restart upon every request??
Even if I do that (which is already too complex), my token would not work across regions. simply because there are two different cognitos, and two different cognito app clients.
Lambdas don’t restart after every request. They get frozen, restoring any global state when the lambda gets thawed for the next request. This feature can be used to create volatile caches.
PS: in case of concurrent lambdas, there is no sharing of this global state.
I understand that. But it seems like it would be going remote to validate the token much more often than its supposed to. The whole purpose of token based authenticates was to have ability to validate token locally. With implementation they are breaking this important capability.
Is it possible to store keys in environment variables for lambda to be always available?
Using very similar approach, but wouldn’t advise using it. If i were happy with solution, I wouldn’t have raised the question here. So using dynamo streams to propagate user data across regions and triggers to recreate cognito users. You also you need to auto-confirm users whenever they are confirmed in one region, and also sync passwords. I dont think that’s a good approach anyways. Probably will go with Auth0
Thanks for sharing. I’ve also been thinking about moving to Auth0. I was hoping to see some announcements for Cognito at re:invent but I don’t think there were any.
FusionAuth seems to be self hosted. This is something I’d like to avoid. Also, there doesn’t see to be significant traction with this project. Something I’d really want to see when it comes to user/password storage
Good points, and understand. FWIW, they do have hosting, usually in AWS unless something else is required. It’s gaining traction fast - around 11,000 downloads in the last 3 months and it doesn’t look like they’ll be letting up anytime soon. They’re quick to respond to issues through email and Github, as well. They rebranded from a product called Passport that was around for about 4 years, so it’s not a brand new company. Passport was successful, but the name was a barrier to getting found.