Home > Net >  AWS Session/Credentials/Auth
AWS Session/Credentials/Auth

Time:11-02

I'm following an AWS workshop for SaaS Serverless, however they wrote it with python code and i'm not very good at python so i'm trying to rewrite everything in javascript. It was doing ok until i get to the problem in title.

They use this function to get authentication so i can register my tenant.

import boto3
from aws_requests_auth.aws_auth import AWSRequestsAuth

def get_auth(host, region):
    session = boto3.Session()
    credentials = session.get_credentials()
    auth = AWSRequestsAuth(aws_access_key=credentials.access_key,
                       aws_secret_access_key=credentials.secret_key,
                       aws_token=credentials.token,
                       aws_host=host,
                       aws_region=region,
                       aws_service='execute-api')
    return auth

The problem is I didn't find a way of getting credentials unless i hardcode it.

My question is: How can i make this function work the same way in javascript?

EDIT: This is the workshop i'm following:

enter image description here

As you are interested in the AWS SDK for JavaScript, look at the DEV Guide for this SDK. You can find detailed information abut creds in this topic :

Setting credentials

  • Related