Posting this here since this is the first thread I found when searching for NodeJS Passport authentication on Lamdba.
Since you can run Express applications on Lamda , you can really run Passport on Lambda directly. However, Passport is indeed middleware specifically for Express, and if you are developing for Lamda in the first place, you probably do not want to bloat Express (since the API gateway basically does all this).
As @Jason mentioned, you can use your own authorizer. It seems pretty straight forward, but who wants to build all possible auth methods? This is one of the advantages of the Passport, people have already done it for you.
If you use the Servlerless Framework , someone has created a “Serviceless Authentication” . This includes modules for many standard auth providers: Facebook , Google , Microsoft . There is also a template for creating additional service providers .
It took me a lot of research to cope with all this, so hopefully this helps someone else.
source share