Skip to content

Commit

Permalink
Jira API token is called a 'token', not a 'key'. (#1030)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaibolay authored Dec 7, 2022
1 parent 8c8c13c commit 36fa1f9
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions 2nd-gen/app-distribution-feedback-to-jira/functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ const issueLabelConfig = defineString("ISSUE_LABEL", {
description: "Label for the Jira issues being created",
default: "in-app",
});
const apiKeyOwnerConfig = defineString("API_KEY_OWNER", {
description: "Owner of the Jira API key",
const apiTokenOwnerConfig = defineString("API_TOKEN_OWNER", {
description: "Owner of the Jira API token",
input: {
text: {
validationRegex:
Expand All @@ -37,8 +37,9 @@ const apiKeyOwnerConfig = defineString("API_KEY_OWNER", {
},
},
});
const apiKeyConfig = defineSecret("API_KEY", {
description: "Jira API key",
const apiTokenConfig = defineSecret("API_TOKEN", {
description: "Jira API token. Created using " +
"https://id.atlassian.com/manage-profile/security/api-tokens",
});

export const handleInAppFeedback = async (event) => {
Expand All @@ -50,15 +51,15 @@ export const handleInAppFeedback = async (event) => {
};

export const feedbacktojira =
onInAppFeedbackPublished({secrets: [apiKeyConfig]}, handleInAppFeedback);
onInAppFeedbackPublished({secrets: [apiTokenConfig]}, handleInAppFeedback);

/**
* Creates "Authorization" header value.
* @return {string} Basic, base64-encoded "Authorization" header value
*/
function authHeader() {
return "Basic " + Buffer
.from(apiKeyOwnerConfig.value() + ":" + apiKeyConfig.value())
.from(apiTokenOwnerConfig.value() + ":" + apiTokenConfig.value())
.toString("base64");
}

Expand Down

0 comments on commit 36fa1f9

Please sign in to comment.