Forum Discussion
Once source of error is possible the getEpochTimeMinute. Maybe it's generating an incorrect value, either because the system clock is wrong, or maybe you're getting seconds instead of minutes or something like that. What I use is Math.floor(Date.now() / 60000);
Other potential source of error is making sure you're sending to correct hash algorithm name when you make the call ("SHA512").
I am using that method for the epoch time and I am passing sha512 in the body when making the call. Maybe I have something incorrect in my headers or body?
const res = await fetch(tokenUrl, { method: "POST", headers: { "Content-Type": "application/json", nonce: nonce, }, body: JSON.stringify({ client_id: clientId, client_secret: clientSecret, redirect_uri: redirectUri, grant_type: "client_credentials", cc_hash: ccHash, hash_algorithm: "sha512", }), });
And just for reference, here are some example values of what my epoch time, nonce, and cc hash are generating as (these are old values from earlier this week so I should be fine posting them here). I have also double checked that my client id, client secret, and shared secret key are all correctly passed as well.
epoch time in minutes: 28888867
nonce: 6b6ba9ada7073749127d628bbdb5c7e4
cc hash (using sha512): 7898dac2f7fb09297bda0f13235ee29596a091ff4a63193a023e3336435f5f5c28a3f5bfe6992ed29383b1cc2fe032876c56f84fb3c99b281595873438dd0a1b
Related Content
- 4 years ago