
Security News
GPT-6 Astra Attempts Supply Chain Attacks Against Open Source Maintainers in Testing
GPT-6 Astra hits 100% on ExploitBench and finds zero-days autonomously, while independent tests reveal scope violations and monitoring gaps.
@alicloud/credentials
Advanced tools
English | 简体中文
npm install @alicloud/credentials
Node.js >= 8.5.0 required.
Before you begin, you need to sign up for an Alibaba Cloud account and retrieve your Credentials.
Setup access_key credential through [User Information Management][ak], it have full authority over the account, please keep it safe. Sometimes for security reasons, you cannot hand over a primary account AccessKey with full access to the developer of a project. You may create a sub-account [RAM Sub-account][ram] , grant its [authorization][permissions],and use the AccessKey of RAM Sub-account.
const Credentials = require('@alicloud/credentials');
const config = {
type: 'access_key', // credential type
accessKeyId: 'accessKeyId', // AccessKeyId of your account
accessKeySecret: 'accessKeySecret', // AccessKeySecret of your account
}
const cred = new Credentials(config);
let accessKeyId = await cred.getAccessKeyId();
let accessKeySecret = await cred.getAccessKeySecret();
let type = cred.getType();
Create a temporary security credential by applying Temporary Security Credentials (TSC) through the Security Token Service (STS).
const Credentials = require('@alicloud/credentials');
const config = {
type: 'sts', // credential type
accessKeyId: 'accessKeyId', // AccessKeyId of your account
accessKeySecret: 'accessKeySecret', // AccessKeySecret of your account
securityToken: 'securityToken', // Temporary Security Token
}
const cred = new Credentials(config);
let accessKeyId = await cred.getAccessKeyId();
let accessKeySecret = await cred.getAccessKeySecret();
let type = cred.getType();
By specifying [RAM Role][RAM Role], the credential will be able to automatically request maintenance of STS Token. If you want to limit the permissions([How to make a policy][policy]) of STS Token, you can assign value for Policy.
const Credentials = require('@alicloud/credentials');
const config = {
type: 'ram_role_arn', // credential type
accessKeyId: 'accessKeyId', // AccessKeyId of your account
accessKeySecret: 'accessKeySecret', // AccessKeySecret of your account
roleArn: 'roleArn', // Format: acs:ram::USER_ID:role/ROLE_NAME
roleSessionName: 'roleSessionName', // Role Session Name
policy: 'policy', // Not required, limit the permissions of STS Token
roleSessionExpiration: 3600, // Not required, limit the Valid time of STS Token
}
const cred = new Credentials(config);
let accessKeyId = await cred.getAccessKeyId();
let accessKeySecret = await cred.getAccessKeySecret();
let securityToken = await cred.getSecurityToken();
let type = cred.getType();
By specifying the role name, the credential will be able to automatically request maintenance of STS Token.
const Credentials = require('@alicloud/credentials');
const config = {
type: 'ecs_ram_role', // credential type
roleName: 'roleName', // `roleName` is optional. It will be retrieved automatically if not set. It is highly recommended to set it up to reduce requests.
}
const cred = new Credentials(config);
let accessKeyId = await cred.getAccessKeyId();
let accessKeySecret = await cred.getAccessKeySecret();
let securityToken = await cred.getSecurityToken();
let type = cred.getType();
By specifying the public key ID and the private key file, the credential will be able to automatically request maintenance of the AccessKey before sending the request. Only Japan station is supported.
const Credentials = require('@alicloud/credentials');
const config = {
type: 'rsa_key_pair', // credential type
privateKeyFile: 'privateKeyFile', // The file path to store the PrivateKey
publicKeyId: 'publicKeyId', // PublicKeyId of your account
}
const cred = new Credentials(config);
let accessKeyId = await cred.getAccessKeyId();
let accessKeySecret = await cred.getAccessKeySecret();
let securityToken = await cred.getSecurityToken();
let type = cred.getType();
If credential is required by the Cloud Call Centre (CCC), please apply for Bearer Token maintenance by yourself.
const Credentials = require('@alicloud/credentials');
const config = {
type: 'bearer', // credential type
bearerToken: 'bearerToken', // BearerToken of your account
}
const cred = new Credentials(config);
let bearerToken = await cred.getBearerToken();
let type = cred.getType();
npm run test
npm run cov
Copyright (c) 2009-present, Alibaba Cloud All rights reserved.
FAQs
alibaba cloud node.js sdk credentials
The npm package @alicloud/credentials receives a total of 40,774 weekly downloads. As such, @alicloud/credentials popularity was classified as popular.
We found that @alicloud/credentials demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.

Security News
GPT-6 Astra hits 100% on ExploitBench and finds zero-days autonomously, while independent tests reveal scope violations and monitoring gaps.

Product
Socket can now send alerts and supply chain attack notifications to Microsoft Teams, with filters that route the right updates to each channel.

Security News
pnpm 12 rewrites the package manager in Rust, cutting install times by up to 90% while preserving pnpm 11 workflows and lockfiles.