Genesys Cloud - Developer Community!

 View Only

Sign Up

Expand all | Collapse all

User Defined Oauth - refresh token mechanism .

  • 1.  User Defined Oauth - refresh token mechanism .

    Posted 07-17-2025 02:53

    Hi All,

    We have created a data action of type user defined Oauth as mentioned in the docuement .How to use the User Defined (OAuth) credential type - Genesys Cloud Resource Center

    When we tested the action , we noticed it is getting failed only in Genesys (not in postman) after 5 minutes . As per backend team confirmation they are seeing the request from genesys with an expired token .

    Genesys document says that , it always stacks the alive token replacing the expired one's . How ever in this case Genesys is sending expired token .
    https://help.mypurecloud.com/faqs/do-data-actions-request-a-new-authentication-token-for-every-request/

    We got to know that genesys caches its token for 60 minutes . When we increated the "expiry time" at the backend from 5 minutes to 60 minutes the issue got resolved .

    Question :
    1. Isn't genesys responsibility to keep its token alive ?

    2.If we want to keep shoter expiry time , who's responsibility is it for refresh token mechanism ?


    #DataActions

    ------------------------------
    Karthik Nachimuthu
    ------------------------------


  • 2.  RE: User Defined Oauth - refresh token mechanism .

    Posted 07-17-2025 07:42

    Hi,

    The article https://help.mypurecloud.com/faqs/do-data-actions-request-a-new-authentication-token-for-every-request says that if the request with a cached token fails it should request a new token and re-try the request so that is what I would expect to happen.

    I assume you have configured a new integration and entered the credentials in it's configuration?

    This would create an Auth Data Action which is used by the other Data Actions in the same integration to get a token.

    I haven't encountered this issue myself so if it's not working as expected I'd create a ticket with support.



    ------------------------------
    Jan Heinonen
    Contact Center Specialist
    GlobalConnect AB
    ------------------------------



  • 3.  RE: User Defined Oauth - refresh token mechanism .

    Posted 07-17-2025 09:25
    Edited by Karthik Nachimuthu 07-17-2025 09:33

    Hi Jan Heinonen,

    Yes , i did create  by providing client_id , client_secret and token_url . The Auth data action is created and it is retrieving the redected token information .

    I also assumed that it would work as it is mentioned in document , but it is not .

    We did raise a case with Geneys they claim that it should be third party who should refresh the token for genesys if it is getting expired and Genesys won't be refreshing the token .

    We were surprised by this response as it is not mentioned in any document . General assumption is that it should be always the requestor who should take care of refresh mechanism and not the token provider .



    ------------------------------
    Karthik Nachimuthu
    ------------------------------



  • 4.  RE: User Defined Oauth - refresh token mechanism .

    Posted 07-17-2025 09:58

    Sound like they probably misunderstood the question, their article clearly states that Genesys should refresh the token.

    If you manually test the Data Action, does it fail after 5 minutes?

    If so, does it work again if you run the Auth action manually?



    ------------------------------
    Jan Heinonen
    Contact Center Specialist
    GlobalConnect AB
    ------------------------------



  • 5.  RE: User Defined Oauth - refresh token mechanism .

    Posted 07-17-2025 10:17

    Yes, it was failing when I manually run it after 5 min. 

    No, It was not working even when I run the auth action manually.

    I tried some workaround :

    • Created an independent data action 1 that would return me , token as the output contract.
    • Created another independent data action 2 that would accept this token as one of its input.
    • Then I pass this token as auth input by calling these two data action back to back in architect flow .
    • It worked 100% of time . 

    Conclusion : Genesys was making request with expired token earlier . So wanted to understand if it is genesys or Thirdparty who should refresh the expired token.



    ------------------------------
    Karthik Nachimuthu
    ------------------------------



  • 6.  RE: User Defined Oauth - refresh token mechanism .

    Posted 07-18-2025 04:09

    We have set it up exactly as Genesys documentation mentions is and Genesys is taking care of requesting a refreshed token if previous one expires. Never faced any issues.



    ------------------------------
    Vineet Kakroo
    Senior Technical Consultant
    ------------------------------



  • 7.  RE: User Defined Oauth - refresh token mechanism .

    Posted 07-18-2025 04:43

    Hi Vineet,

    Few questions 

    1. Do you know what is the expiry time set by your third party ?
    2. Any idea on whether your thirdparty is refreshing the token or is it from genesys end ?


    ------------------------------
    Karthik Nachimuthu
    ------------------------------



  • 8.  RE: User Defined Oauth - refresh token mechanism .

    Posted 07-18-2025 05:54

    I am not sure on the expiry time that is set on the ORG, but we have not defined any other time-limit (if its possible to do so).
    As far as I know Genesys requests a new token when old one is expired and gets the new token back from the 3rd party endpoint. this mechanism is designed as a PULL and will only be initiated by Genesys



    ------------------------------
    Vineet Kakroo
    Senior Technical Consultant
    ------------------------------



  • 9.  RE: User Defined Oauth - refresh token mechanism .
    Best Answer

    Posted 07-18-2025 04:49

    Hello

    As far as I´ve tested in the past, Genesys stores the token internally, and makes new Auth requests when it gets invalid (for example, if it gets a 401 error, it retries to authenticate once more). I would check in the backend what requests it is receiving and what it is re Uploading... Upload file  sponding.



    ------------------------------
    Adrián Santamaría
    ------------------------------



  • 10.  RE: User Defined Oauth - refresh token mechanism .

    Posted 07-18-2025 06:16
    Edited by Karthik Nachimuthu 07-18-2025 06:40

    As you all mentioned even my assumption is that Genesys renew its expired token .However below is the response from Genesys for the case that we raised , which is completely contradicting to what they have mentioned in their documents .

    Respone from genesys as follows

    "Our cache for auth tokens is not relevant here, and that is essentially proven by how they solved the issue by increasing their cache expiry time, which we had already indicated in the original case. If they are the ones issuing the auth token to be used with data action requests, it is on them to define an expiry period and make sure they're renewing and fetching new tokens when that expiration happens. Our expiration period for the token cache will not play into it at all.

    Since we're not generating the token or maintaining it in our platform, we are not going to have any way to know that it's expired. Data actions do not act smart in that sense, they simply send what they're told to send.

    As mentioned earlier, our cache for auth tokens is not relevant here since the token was not generated by Genesys in your case. Therefore, Genesys will not be involved in renewing a token that it didn't generate."

     



    ------------------------------
    Karthik Nachimuthu
    ------------------------------



  • 11.  RE: User Defined Oauth - refresh token mechanism .

    Posted 07-18-2025 06:32

    I can't see the response from Genesys.



    ------------------------------
    Vineet Kakroo
    Senior Technical Consultant
    ------------------------------



  • 12.  RE: User Defined Oauth - refresh token mechanism .

    Posted 07-23-2025 09:58

    Can you post or directly send me the support case ID?

    We document our expected behavior here:

    https://help.mypurecloud.com/faqs/do-data-actions-request-a-new-authentication-token-for-every-request/

    If the 3rd party expires the token before our cache expires then the expectation is that we would make a request, get a 401 back, clear our cache, request a new token, and attempt the request again with the new token.

    The only obvious way that this would fail as you are describing is if the 3rd party is returning a surprising result code when the token expires, like a 400.



    ------------------------------
    --Jason
    ------------------------------



  • 13.  RE: User Defined Oauth - refresh token mechanism .

    Posted 07-23-2025 21:03

    Here it is , Case #0003793421.



    ------------------------------
    Karthik Nachimuthu
    ------------------------------



  • 14.  RE: User Defined Oauth - refresh token mechanism .

    Posted 07-28-2025 03:00

    Response from Genesys :

    If the external TTL of a token is shorter than this duration, Genesys will not refresh the token until it receives a 401 error. When a 401 error occurs, the token will be refreshed, and Genesys will re-authenticate upon receiving an unauthorized request.

    May be this is the issue in my case . We are receiving 500 error code from backend .

    Thanks all for the inputs .



    ------------------------------
    Karthik Nachimuthu
    ------------------------------