Socket
Socket
Sign inDemoInstall

@aws-sdk/client-sts

Package Overview
Dependencies
Maintainers
5
Versions
395
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-sdk/client-sts

AWS SDK for JavaScript Sts Client for Node.js, Browser and React Native


Version published
Weekly downloads
22M
increased by10.3%
Maintainers
5
Weekly downloads
 
Created

What is @aws-sdk/client-sts?

The @aws-sdk/client-sts package is a modular AWS SDK for JavaScript clients for AWS Security Token Service (STS). It allows developers to interact with the STS service, enabling them to request temporary, limited-privilege credentials for AWS Identity and Access Management (IAM) users or for users that you authenticate (federated users).

What are @aws-sdk/client-sts's main functionalities?

AssumeRole

AssumeRole allows you to request temporary security credentials for a role. This is useful for scenarios where you need to grant access to your AWS resources to users or systems without AWS accounts.

const { STSClient, AssumeRoleCommand } = require('@aws-sdk/client-sts');
const client = new STSClient({ region: 'us-west-2' });
const command = new AssumeRoleCommand({
  RoleArn: 'arn:aws:iam::123456789012:role/demo',
  RoleSessionName: 'session1'
});
client.send(command).then((response) => {
  console.log(response.Credentials);
});

GetSessionToken

GetSessionToken is used to retrieve a session token for use with AWS services. This is typically used when you have an IAM user and you want to create a temporary session with enhanced security, such as MFA.

const { STSClient, GetSessionTokenCommand } = require('@aws-sdk/client-sts');
const client = new STSClient({ region: 'us-west-2' });
const command = new GetSessionTokenCommand({
  DurationSeconds: 3600
});
client.send(command).then((response) => {
  console.log(response.Credentials);
});

AssumeRoleWithWebIdentity

AssumeRoleWithWebIdentity allows you to request temporary security credentials for users who have been authenticated in a mobile or web application with a web identity provider, such as Amazon Cognito, Login with Amazon, Facebook, Google, or any OpenID Connect-compatible identity provider.

const { STSClient, AssumeRoleWithWebIdentityCommand } = require('@aws-sdk/client-sts');
const client = new STSClient({ region: 'us-west-2' });
const command = new AssumeRoleWithWebIdentityCommand({
  RoleArn: 'arn:aws:iam::123456789012:role/demo',
  RoleSessionName: 'web-identity-session',
  WebIdentityToken: 'token'
});
client.send(command).then((response) => {
  console.log(response.Credentials);
});

Other packages similar to @aws-sdk/client-sts

FAQs

Package last updated on 04 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc