How to use qcloud-cos-sts - 3 common examples

To help you get started, we’ve selected a few qcloud-cos-sts examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tencentyun / scf-demo-repo / Node8.9_CosCdnRefresh / node_modules / cos-nodejs-sdk-v5 / demo / demo-sts-scope.js View on Github external
getAuthorization: function (options, callback) {

        // TODO 这里根据自己业务需要做好放行判断
        if (!allowScope()) {
            console.log('deny Scope');
            return;
        }

        // 获取临时密钥
        var policy = STS.getPolicy(options.Scope);
        STS.getCredential({
            secretId: config.SecretId,
            secretKey: config.SecretKey,
            policy: policy,
            // durationSeconds: 1800,
            proxy: '',
            region: 'ap-guangzhou'
        }, function (err, data) {
            if (err) {
                console.error(err);
            } else {
                console.log(data);
                var credentials = data.credentials;
                callback({
                    TmpSecretId: credentials.tmpSecretId,
                    TmpSecretKey: credentials.tmpSecretKey,
                    XCosSecurityToken: credentials.sessionToken,
github tencentyun / scf-demo-repo / Node8.9_CosCdnRefresh / node_modules / cos-nodejs-sdk-v5 / demo / demo-sts-scope.js View on Github external
getAuthorization: function (options, callback) {

        // TODO 这里根据自己业务需要做好放行判断
        if (!allowScope()) {
            console.log('deny Scope');
            return;
        }

        // 获取临时密钥
        var policy = STS.getPolicy(options.Scope);
        STS.getCredential({
            secretId: config.SecretId,
            secretKey: config.SecretKey,
            policy: policy,
            // durationSeconds: 1800,
            proxy: '',
            region: 'ap-guangzhou'
        }, function (err, data) {
            if (err) {
                console.error(err);
            } else {
                console.log(data);
                var credentials = data.credentials;
                callback({
                    TmpSecretId: credentials.tmpSecretId,
                    TmpSecretKey: credentials.tmpSecretKey,
github tencentyun / scf-demo-repo / Node8.9_CosCdnRefresh / node_modules / cos-nodejs-sdk-v5 / demo / demo-sts.js View on Github external
getAuthorization: function (options, callback) {
        STS.getCredential({
            secretId: config.SecretId,
            secretKey: config.SecretKey,
            policy: policy,
            durationSeconds: 7200,
            proxy: '',
            region: 'ap-guangzhou'
        }, function (err, data) {
            if (err) {
                console.error(err);
            } else {
                var credentials = data.credentials;
                callback({
                    TmpSecretId: credentials.tmpSecretId,
                    TmpSecretKey: credentials.tmpSecretKey,
                    XCosSecurityToken: credentials.sessionToken,
                    ExpiredTime: data.expiredTime,

qcloud-cos-sts

## 安装方法

MIT
Latest version published 3 months ago

Package Health Score

70 / 100
Full package analysis

Similar packages