We are currently using the Oauth client credentials workflow to get an access token for our API requests. Once we retrieve the access token we store it in memory on our server until the expiry time after which we request a new token. Intermittently (like 3-5 times a week) we will get the following error:
Error: getaddrinfo EAI_AGAIN login.usw2.pure.cloud login.usw2.pure.cloud:443
Any ideas why we are getting this error or the best way to handle it? I'm thinking of adding logic to retry the request a couple of times if it fails but I'd rather get to the root cause of this issue.
let options = {
method: 'POST',
url: 'https://login.usw2.pure.cloud/oauth/token',
headers:
{
'Content-Type': 'application/x-www-form-urlencoded',
Authorization: 'Basic ' + Buffer.from(clientId + ':' + clientSecret).toString('base64'),
'Host': 'login.usw2.pure.cloud'
},
form:
{
'grant_type': 'client_credentials'
}