About executing ApiClient.authorizeClientCredentials

Hi,

My application periodically calls ApiClient.authorizeClientCredentials() to maintain a connection with GenesysCloud.

・Is there a limit to the interval for executing authorizeClientCredentials()?
(e.g. leave at least N seconds (hours))

・Does it affect the execution of other APIs (e.g. NotificationsApi)?

Regards,

Hi,

When you authorize a client credential grant you will can an object back from the call. In that returned object there is an expires_in attribute that contains the number of seconds the token will be active for. You can use that value to calculate how long you have before the token expires. You do not need to poll the API periodically to get a new token. Instead, at the time the token is created, take the date/time and the expiration time and calculate when the token will expire, and then call to create a new one.

This is way more efficient than polling.

Thanks,
John Carnell
Director, Developer Engagement

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.