Socket
Socket
Sign inDemoInstall

@alicloud/sts-sdk

Package Overview
Dependencies
6
Maintainers
8
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @alicloud/sts-sdk

alibaba cloud sts client for node.js


Version published
Weekly downloads
411
increased by13.54%
Maintainers
8
Install size
804 kB
Created
Weekly downloads
 

Readme

Source

Alibaba Cloud STS client for Node.js

npm version Travis Build Status Appveyor Build status codecov license

Installation

npm install @alicloud/sts-sdk

Node.js >= 8.5.0 required.

Usage

const StsClient = require('@alicloud/sts-sdk');

const sts = new StsClient({
  endpoint: 'sts.aliyuncs.com', // check this from sts console
  accessKey: '***************', // check this from aliyun console
  secretKey: '***************', // check this from aliyun console
});

async function demo() {
  const res1 = await sts.assumeRole(`acs:ram::${accountID}:role/${roleName}`, 'xxx');
  console.log(res1);
  const res2 = await sts.getCallerIdentity();
  console.log(res2);
}

demo();

API Doc

Method: assumeRole()

Arguments
  • roleArn String required - aliyun resource name, acs:ram::${accountID}:role/${roleName}
  • roleSessionName String required - differentiate tokens, /^[a-zA-Z0-9.@-_]+$/
  • policy String optional - @see https://help.aliyun.com/document_detail/28664.html
  • durationSeconds Number optional - the specified expiration time (seconds), range: 900~3600, default value is 3600
Returns
  • credentials Object - sts credentials

Method: getCallerIdentity()

Returns
  • userInfo Object - the identity of the current caller

Method (Japan only): generateSessionAccessKey()

Returns
  • akInfo Object - session key & secret

Keywords

FAQs

Last updated on 25 Feb 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc