Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

189
Visualizações
How to return CognitoIdentityCredentials from lambda

I am trying to send the Cognito identity Credentials back to the client but am struggling to get the data after it has been initialized. Currently it is returning undefined and when I print the config credentials it is clear that it is printing before initialization.

const AWS = require('aws-sdk');

exports.handler = function(event, context, callback) {

    AWS.config.region = 'us-east-1';
    var token = event.authorizationToken;

    // Configure credentials
    AWS.config.credentials = new AWS.CognitoIdentityCredentials({
        IdentityPoolId: IdP,
        Logins: { 'example.com': token }
    });

    // Obtain credentials
    AWS.config.credentials.get(function(){
        AWS.config.credentials = new AWS.CognitoIdentityCredentials({
            identityId: AWS.config.credentials.identityId
        });
        console.log(AWS.config.credentials)
        callback(null, {
          statusCode: 200,
          body: JSON.stringify(AWS.config.credentials.CognitoIdentityCredentials)
        });
    });
};
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda