Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

225
Vistas
Why can't I authenticate API Gateway with Cognito User Pools in Node.js?

I'm trying to authorize API Gateway calls using a Cognito User Pool Authorizer. If I get the access token from the Hosted UI offered by AWS and pass it as a header in Postman, everything works fine and I can call my APIs.

So I decided to see if I can get that JWT token programmatically in Node.js, without using Amplify. By using the 'amazon-cognito-identity-js' node module (which is what Amplify actually uses), I can authenticate to a Cognito User Pool successfully (calling the CognitoUser() method, then calling authenticateUser() and finally in its callback I can get the tokens needed with result.getAccessToken().getJwtToken()). This way I can get an access token, an id token and a refresh token. However, that access token doesn't work in Postman and the API returns unathorized.

I tried to analyze the structure of it and it's very similar to the access token returned by the Hosted UI. The only differences are: it doesn't have a version property, the scope is different and it has an extra origin_jti property. The iss, client_id and username are the same.

What am I doing wrong?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda