Skip to content

a demo show how to generate App Store Connect API jwt token in js

Notifications You must be signed in to change notification settings

GWesley/AppStoreConnectAPI_JWT_TOKEN_DEMO

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

AppStoreConnectAPI_JWT_TOKEN_DEMO

a demo about how to generate App Store Connect API jwt token in js

const jwt = require("jsonwebtoken");
const fs = require("fs");
const dayjs = require("dayjs");

generateJWTForAppstore() {
    //Generating JWT Tokens for App Store Connect API
    var privateKey = fs.readFileSync("resources/AuthKey_7BUF2NGAHQ.p8");
    var token = jwt.sign(
      {
        iss: "69a6de8d-e294-47e3-e053-1234566",
        iat: dayjs().unix(),
        exp: dayjs().add(20, "minute").unix(),
        aud: "appstoreconnect-v1",
      },
      privateKey,
      {
        algorithm: "ES256",
        header: {
          alg: "ES256",
          kid: "7BUF2NGAHQ",
          typ: "JWT",
        },
      }
    );
    return token;
  }

About

a demo show how to generate App Store Connect API jwt token in js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published