{"record":{"id":"2ec0687b1e76fbb3","repo":"usebruno/bruno","slug":"edgegrid-clienttoken-is-required","errorCode":null,"errorMessage":"EdgeGrid: clientToken is required","messagePattern":"EdgeGrid: clientToken is required","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bruno-requests/src/auth/edgegrid-helper.js","lineNumber":45,"sourceCode":" * @param {string} config.clientSecret\n * @param {string} [config.baseURL] - override host the request is signed against\n * @param {string} [config.nonce] - optional nonce override\n * @param {string} [config.timestamp] - optional timestamp override\n * @param {string} [config.headersToSign] - comma-separated header names to sign\n * @param {string|number} [config.maxBodySize=131072]\n * @param {Object} request - axios request config ({ method, url, headers, data })\n * @returns {Promise<string>} Authorization header value\n */\nexport async function signEdgeGridRequest(config, request) {\n  const { accessToken, clientToken, clientSecret, baseURL, headersToSign } = config;\n  const maxBodySize = config.maxBodySize ? parseInt(config.maxBodySize, 10) : MAX_BODY_SIZE_DEFAULT;\n\n  // Validate required fields\n  if (!isStrPresent(accessToken)) {\n    throw new Error('EdgeGrid: accessToken is required');\n  }\n  if (!isStrPresent(clientToken)) {\n    throw new Error('EdgeGrid: clientToken is required');\n  }\n  if (!isStrPresent(clientSecret)) {\n    throw new Error('EdgeGrid: clientSecret is required');\n  }\n\n  // Generate or use provided nonce and timestamp\n  const nonce = isStrPresent(config.nonce) ? config.nonce : makeEdgeGridNonce();\n  const timestamp = isStrPresent(config.timestamp) ? config.timestamp : makeEdgeGridTimestamp();\n\n  // Determine the URL to sign — use baseURL's host/protocol if provided, otherwise the request URL.\n  let urlToSign = request.url;\n  if (isStrPresent(baseURL)) {\n    const requestUrl = new URL(request.url);\n    // A scheme-less baseURL like \"localhost:6000\" mis-parses (\"localhost:\" becomes the protocol\n    // and the host is empty). If there's no \"scheme://\", borrow the request URL's scheme.\n    const normalizedBaseURL = /^[a-z][a-z0-9+.-]*:\\/\\//i.test(baseURL.trim())\n      ? baseURL.trim()\n      : `${requestUrl.protocol}//${baseURL.trim()}`;","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-requests/src/auth/edgegrid-helper.js#L27-L63","documentation":"Thrown by Bruno's Akamai EdgeGrid signing helper when the `clientToken` field is missing or blank (isStrPresent returns false). The client token identifies the API client and is mandatory for the EG1-HMAC-SHA256 auth header.","triggerScenarios":"Configuring EdgeGrid auth with an empty or unset clientToken field — e.g. the field was wired to a Bruno variable that is not defined in the active environment.","commonSituations":"Wrong environment selected; variable rename missed this field; clientToken field left as the default placeholder text that was then cleared.","solutions":["Set config.clientToken to the Akamai API client token.","Verify the Bruno variable sourcing the value exists in the active environment.","Add a pre-send assertion that all three EdgeGrid credentials are non-empty."],"exampleFix":"// before\nconst config = { accessToken: '...', clientSecret: '...' }; // clientToken missing\n\n// after\nconst config = {\n  accessToken: bru.getVar('EDGEGRID_ACCESS_TOKEN'),\n  clientToken: bru.getVar('EDGEGRID_CLIENT_TOKEN'),\n  clientSecret: bru.getVar('EDGEGRID_CLIENT_SECRET')\n};","handlingStrategy":"validation","validationCode":"function validateEdgeGrid(cfg) {\n  const missing = ['clientToken'].filter((k) => !cfg[k] || !String(cfg[k]).trim());\n  if (missing.length) throw new Error('EdgeGrid missing: ' + missing.join(','));\n}","typeGuard":"const hasClientToken = (cfg) => typeof cfg?.clientToken === 'string' && cfg.clientToken.trim().length > 0;","tryCatchPattern":"try { await signEdgeGridRequest(config, request); }\ncatch (err) {\n  if (/clientToken is required/.test(err.message)) { config.clientToken = bru.getVar('EDGEGRID_CLIENT_TOKEN'); }\n  else throw err;\n}","preventionTips":["Keep clientToken in a versioned Bruno environment.","Validate all three EdgeGrid fields together before sending.","Watch for variable name typos."],"tags":["bruno-requests","auth","edgegrid","akamai","validation"],"backgroundTag":null,"analyzedSha":"9bdd81c7bdc57006e5f5ebffb79321a8d979f712","analyzedAt":"2026-08-13T04:09:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}