I have built a backend API in Expressjs app, I am hosting it on AWS EC2. I have built a frontend application in Vuejs to communicate with the Express API.
I need to create Authorization for users to sign-in, and have decided AWS Cognito for user management.
Looking through the docs, do not really give much on how to authenticate from a front-end application to the backendAPI.
I know I can authenticate the Vuejs but that still leaves my routes open to be called directly.
So my question is how do I sign in from a frontend application like VueJS and verify the Auth token in the backend API endpoints.
Looking for any logic or possible docs on how to accomplish this, or if I am not looking at this correctly if someone can gives some tips.
First, you will to authenticate your users with Cognito:
At that point you will have a set of JWT tokens (ID token, access token and, depending on auth flow you choose, refresh token).
You can now pass ID/access token to your backend API and verify it:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With