Legacy Dev Forum Posts

 View Only

Sign Up

About executing ApiClient.authorizeClientCredentials

  • 1.  About executing ApiClient.authorizeClientCredentials

    Posted 06-05-2025 18:24

    mkoya | 2023-01-30 08:35:58 UTC | #1

    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,


    John_Carnell | 2023-02-06 13:59:01 UTC | #2

    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


    system | 2023-03-09 13:59:09 UTC | #3

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


    This post was migrated from the old Developer Forum.

    ref: 18185