Authenticating an AWS Lambda against a protected API

I’ve encountered a problem and would love an assistant,
I’m using auth0 to manage authentications between a react app (SPA application in auth0) and an express backend, also, i need to access the same express backend from a lambda function.

I’ve used M2M authentication to generate access token in the lambda function, this lambda is ran few thousand times few times a month, so i did used my quota pretty quickly.

Is M2M auth is the right way to go in my case? or is there a better way?
Is there any way to reduce costs in this case?

Thanks for the help

Hi @shaked.hadas,

Welcome to the Auth0 Community!

Yes, M2M would be the right approach here. You should find some way to cache the token.

It looks like lambda has a caching extension: Caching data and configuration settings with AWS Lambda extensions | AWS Compute Blog

1 Like

Thanks for your help! i will look into it

1 Like

Let us know if you have any questions.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.