Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 6x 6x 6x 56x 9x 9x 9x 9x 56x | 'use strict'; const coreModule = require('./../core'); const encoding = require('./../encoding'); /** * Clients credentials flow implementation */ module.exports = (config) => { const core = coreModule(config); /** * Returns the Access Token Object * @param {Object} params * @param {String|Array<String>} params.scope A String or array of strings * that represents the application privileges * @return {Promise} */ async function getToken(params) { const baseParams = { grant_type: 'client_credentials', }; const scopeParams = encoding.getScopeParam(params.scope); const options = Object.assign(baseParams, params, scopeParams); return core.request(config.auth.tokenPath, options); } return { getToken, }; }; |