Hi,
I'm working on migrating from the old api to the new one and I don't understand how to reuse the "access_token".
When using OAuth2TokenBuilder and AdWordsSessionBuilder, I can set the "refresh_token" but not the "access_token".
If I understand correctly, setting only the refresh_token will force to get a new access_token everytime I create a new instance of OAuth2TokenBuilder (which is instantiating a UserRefreshCredentials object when the ->build() method is called in my case).
This probably works (not sure there might be race condition with multiple requests in // and then one access_token might be invalid), but this means that an access_token will be fetched everytime, so two http requests instead of one.
When I have an access_token which is valid for 3600 seconds, I'd like to be able to reuse it for the valid period, but I can't as there is no method in OAuth2TokenBuilder nor UserRefreshCredentials to set the "access_token" when I instantiate my objects on new client http requests.
In your response, you say "The first section builds OAuth2 access token fetchers, which will get access tokens as and when required". But how can this happen if the access_token is not provided? As it is not provided, a new http request needs to be done to get one before doing the adwords api request, right?
Now, I really can't see how to reuse an existing "access_token" with the new api, only the "refresh_token".
Am I missing something?
Thank you for any help/feedback.
PS: My next problem is to detect that those object are effectively refreshing the access_token because I'd like to update/save/cache the new one to be able to reuse it again for the active time period (usually one hour). That will probably be my next question. The new api seem very weird in this regard. The google/google-auth-library-php (which is used by the adwords library) seem to have the same problem (The app is unable to get/cache/manage the access_token in an easy way).