Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jira API token is called a 'token', not a 'key'. #1030

Merged
merged 1 commit into from
Dec 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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