A POC demonstrating how to create passwordless authentication system using AWS Cognito, Lambda and the Serverless framework.
The repository has two parts:
- the
backenddeveloped with serverless, aws and typescript and - the
clientdeveloped using react and typescript bootstrapped with vite.
git clone git@github.com:Collaborne/aws-serverless-cognito-passwordless-auth-poc.git
cd aws-serverless-cognito-passwordless-auth-poc
cd backend
npm install
- Open the
serverless.ymlfile - Set your values for:
- provider.profile (serverlessUser)
- provider.region
- custom.emailFrom
npm run build
npx serverless deploy
- Run
npx sls info --verboseto get the values ofUserPoolClientId,UserPoolIdandServiceEndpoint(You will need these for the client).
cd client
npm install
- Create a
.envfrom the.env.exampletemplate - Set the values of
VITE_REGION,VITE_USER_POOL_IDandVITE_USER_POOL_WEB_CLIENT_ID(These are the values you get from step 4 above).
npm run dev
- In a browser, open the sign up page at
http://localhost:5173/sign-upand you can sign in fromhttp://localhost:5173/sign-in
The authentication process is not secured since only an email is required to register and login. The implication of this is that any email can be used to register and the knowledge of someone's email can get me access to their account (since emails are not private entities).
There should be a limit of operations that can be performed by users with this type of authentication. Deleting and Editing should be restricted to users with more secure authentication methods.