How to use the @sap/xssec.constants function in @sap/xssec

To help you get started, we’ve selected a few @sap/xssec 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 SAP / leonardo-iot-sdk-nodejs / lib / auth / Authenticator.js View on Github external
xssec.createSecurityContext(accessToken, this._xsuaaService.credentials, function (err, securityContext) {
                if (err) {
                    debug(`Token exchange error: ${err}`);
                    return reject(err);
                }

                debug('Security context created successfully');
                let grantType = xssec.constants.TYPE_USER_TOKEN;
                if (securityContext.getGrantType() === 'client_credentials') {
                    grantType = xssec.constants.TYPE_CLIENT_CREDENTIALS_TOKEN;
                }

                securityContext.requestToken(this._credentials, grantType, {}, function (err, newToken) {
                    if (err) {
                        debug(`Token exchange error: ${err}`);
                        return reject(err);
                    }

                    debug('Token successfully exchanged');
                    return resolve(newToken);
                });
            }.bind(this));
        }.bind(this));
github SAP / leonardo-iot-sdk-nodejs / lib / auth / Authenticator.js View on Github external
xssec.createSecurityContext(accessToken, this._xsuaaService.credentials, function (err, securityContext) {
                if (err) {
                    debug(`Token exchange error: ${err}`);
                    return reject(err);
                }

                debug('Security context created successfully');
                let grantType = xssec.constants.TYPE_USER_TOKEN;
                if (securityContext.getGrantType() === 'client_credentials') {
                    grantType = xssec.constants.TYPE_CLIENT_CREDENTIALS_TOKEN;
                }

                securityContext.requestToken(this._credentials, grantType, {}, function (err, newToken) {
                    if (err) {
                        debug(`Token exchange error: ${err}`);
                        return reject(err);
                    }

                    debug('Token successfully exchanged');
                    return resolve(newToken);
                });
            }.bind(this));
        }.bind(this));

@sap/xssec

XS Advanced Container Security API for node.js

SAP DEVELOPER LICENSE AGREEME…
Latest version published 5 days ago

Package Health Score

62 / 100
Full package analysis