def __get_credentials()

in ingest_er7_service/ingest_er7_lambda.py [0:0]


def __get_credentials(userPoolId, identityPoolId, cognitoEndpoint, idToken):
  # Get the identity pool ID of the user
  idId = cognito_identity.get_id(
    IdentityPoolId=identityPoolId,
    Logins={
        cognitoEndpoint+"/"+userPoolId: idToken
    }
  )['IdentityId']

  # Get credentials
  response = cognito_identity.get_credentials_for_identity(
    IdentityId=idId,
    Logins={
        cognitoEndpoint+"/"+userPoolId: idToken
    }
  )
  return (response['Credentials'])