Post

Replies

Boosts

Views

Activity

Reply to Connect Store Server API always return 401
Hello @ChuckMN, Hope you are doing well. Thanks for your time. I will try to do what you mention and let you know. In the mean time, I tried to use the "app-store-server-api" library that will handle everything from 0 to request. and tried with the below to generate tokens as well : const jwt = require('jsonwebtoken'); const jws = require('jws'); let now = Math.floor((new Date()).getTime() / 1000); // Notice the /1000 let nowPlus20 = now + 600 // 1200 === 20 minutes let payload = { "iss": issuerId, "exp": nowPlus20, "aud": "appstoreconnect-v1", //bid: bundleId, iat: now, // "scope": [ // "GET /v1/users" // ], // nonce: '6edffe66-b482-11eb-8529-0242ac130003'// (0, uuid_1.v4)() } let signOptions = { "algorithm": "ES256", // you must use this algorythm, not jsonwebtoken's default header: { "alg": "ES256", "kid": keyId, "typ": "JWT" } }; let token2 = jws.sign({header: signOptions.header, payload, secret: key.trim()}); let token = jwt.sign(payload, key.trim(), signOptions);
Jun ’22