I am currently trying to make a webservice callout via Apex to update some fields on an object. We have an insert trigger that is linked to an Apex handler class. To use the webservice, I must first use a POST method to get an access token, then a GET request to get the information I need.
The problem I'm running into is I have to use a @future method to get the Access Token since it is being called from a trigger which causes 2 problems: 1. I cant return the token to a public variable in the class and 2. the context is now asynchronous so I cant guarantee the order of exception for the GET request to follow the POST request.
I was thinkin about using Queueable apex to be called after the POST request. Is there a better way to do this?