I also tried with app-store-server-library-node.
It responds 401 too.
code
import { AppStoreServerAPIClient, Environment } from "@apple/app-store-server-library"
import { readFileSync } from "fs"
import { bid, iss, kid, p8FilePath } from "./values.js"
const filePath = p8FilePath
const signingKey = readFileSync(filePath).toString()
const keyId = kid
const issuerId = iss
const bundleId = bid
const environment = Environment.SANDBOX
const client = new AppStoreServerAPIClient(signingKey, keyId, issuerId, bundleId, environment)
try {
const response = await client.requestTestNotification()
console.log(response)
} catch (e) {
console.error(e)
}
output
APIException [Error]
at /Users/***/projects/app-store-notify/node_modules/@apple/app-store-server-library/dist/index.js:131:27
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async AppStoreServerAPIClient.requestTestNotification (/Users/kawashimatakayoshi/projects/app-store-notify/node_modules/@apple/app-store-server-library/dist/index.js:300:16)
at async file:///Users/***/projects/app-store-notify/api.js:15:20 {
httpStatusCode: 401,
apiError: null
}