I'm trying to implement the following scheme:
with Angular SPA on the frontend and Gateway API + lambda functions on the backend
Since my app requires authentication, there will be /auth endpoint checking user credentials (users are stored in DynamoDB) and returning auth tokens (JWT) in case of success. Client will have to send auth tokens with every request to backend, and my lambda functions will have to validate those tokens.
This scheme looks good, but I'm wondering can it be changed somehow so that responsibility to check tokens is moved out of lambda functions (lambdaAction on the picture above)?
I have seen tutorials of using third-party services like Auth0 with authentication taking place in Gateway API, before any lambda functions (see the link for example) But I can't figure out how to use those services with users stored in my own DB.
So, my question, in short: is it possible to use Gateway API with token-based authentication with users stored in my database
