mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-09-30 06:53:14 +00:00
fix: Replace newlines in generate jwt (#665)
* fix: Replace newlines in generate jwt * cr
This commit is contained in:
parent
1eb315eed9
commit
d1a6a78d7d
1 changed files with 7 additions and 1 deletions
|
|
@ -1,5 +1,8 @@
|
|||
import { generateJWT } from "../jwt.js";
|
||||
|
||||
const replaceNewlinesWithBackslashN = (str: string) =>
|
||||
str.replace(/\n/g, "\\n");
|
||||
|
||||
/**
|
||||
* Gets an installation access token for a GitHub App installation
|
||||
*/
|
||||
|
|
@ -8,7 +11,10 @@ export async function getInstallationToken(
|
|||
appId: string,
|
||||
privateKey: string,
|
||||
): Promise<string> {
|
||||
const jwtToken = generateJWT(appId, privateKey);
|
||||
const jwtToken = generateJWT(
|
||||
appId,
|
||||
replaceNewlinesWithBackslashN(privateKey),
|
||||
);
|
||||
|
||||
const response = await fetch(
|
||||
`https://api.github.com/app/installations/${installationId}/access_tokens`,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue