I want to call several APIs from architect using data action
if those APIs are using OAuth 2.0
does genesys cloud will call the OAuth URL to get the token for each API call ? or several API calls within the same interaction will use the same shared token and cookies?
and if 2 interactions are made to the same API using the same OAuth, will both use the same Token? or the token will be generated for each call?
I did an experiment to test this a few years ago. I do not know if it still has the same behaviour, but back then it looked like Genesys internally stored the token, and used it for all the subsequent requests until it got a 401 error, when it requested a new one.
I tested it with a Data Action inside an Inbound Call flow, and then I made multiple calls (sequentially, not concurrent). In the server, I saw that for the first one, it generated a new token, and for the subsequent ones it used said token for all of them. When I invalidated it, the next try got a 401, so it made the request to generate a new one.
The data actions service will cache a relatively small number of authentication tokens and reuse them for a while. For an active data action you can expect a very low percentage of requests to involve generating a new authentication token. As you noted, getting a 401 on a request will result in us throwing away the token, getting a new one. Once the service has the new token it will retry the original request with the new token.
I'm being intentionally vague as this isn't a behavior that we want to formally document and lock ourselves into
Out of curiosity, what generated this question in the first place? Just wanting to know how the service works, or does the number of authentication requests have a cost in terms of $$$ or latency?
For me, it was curiosity about how it worked under the hood But it's true that some services out there limit the number of tokens that they issue (your API does, as well), so knowing if there were an Auth cache or not was something that we wanted to know to have it in mind in case it was a limitation.