@taurgis/sfccdx
Version:
SFCCDX is a command line interface (CLI) for Salesforce Commerce Cloud. It can be used to easily manage (meta)data (import/export) in relation to your project.
27 lines (25 loc) • 721 B
JavaScript
const ccci = require('sfcc-ci');
/**
* Fetches the OCAPI token from the server.
*
* @param {string} clientid The client id.
* @param {string} clientsecret The client secret.
*
* @returns {Promise} A promise that resolves with the token.
*/
class Token {
static get(clientid, clientsecret) {
return new Promise((resolve, reject) => {
ccci.auth.auth(clientid, clientsecret, (e, token) => {
// Was an error caught?
if (e) {
reject(e);
} else {
// Execute the callback and pass-in the token
resolve(token);
}
});
});
}
}
module.exports = Token;