How to setup query profile for rest API with OAuth2 authentication with variable for token?

Hi!

 

I need to fetch data from an external database via a rest API using OAuth2 authentication. I have credentials, and manage to POST and get a token as in the reply. Token lasts for one hour, and I need to set up a query profile together with some Python scrips functionality in a API Function in an etl job. I need to fetch a token, and store it in a variable to communicate this between job and query profile. Then I can POST to get a token returned, and use this token when fetching data in another call to the API.

 

Does anyone have a recepie for this? What to do where? How to set up things?

 

Thanks...

 

//Ketil