Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

478
Views
Using AWS Cognito Vuejs

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.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

First, you'll authenticate your users with Cognito:

  • either using their hosted UI ( https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-app-integration.html )
  • or with Amplify ( https://aws-amplify.github.io/docs/js/authentication )
  • or with the AWS SDK if you want to downgrade ( https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_InitiateAuth.html )

At that point, you'll have a set of JWT tokens (ID token, access token, and depending on the authentication flow you choose, refresh token).

Now you can pass the access token/id to your backend API and verify it:

  • using the API Gateway Lambda authorizer, if applicable ( https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-integrate-with-cognito.html )
  • verifying the token and claims manually ( https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-using-tokens-verifying-a-jwt.html ). You can find implementations of this on Github.
    If you're using Node, one of the options is cognito-jwt-verifier : a small npm package to verify id and access JWT tokens obtained from AWS Cognito in your node/Lambda backend with minimal dependencies (disclaimer: I'm the package author).
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!