Programmatically Setting and Using Environment Variables

Hello,

We have an /oauth/token route that our API customers use to generate the token for accessing the remainder of our available routes. I have the /oauth/token route set up in Apidog with post processing to save the token from the response to an environment variable and confirmed it works in the desktop client. I also have another route I’m using to test this scenario with that has the Auth type set to Bearer Token and I have the Token values set to retrieve the variable {{access-token}}. This all works fine in the desktop client, but when I publish and test it out in the browser using “Try it out” it does not work. It doesn’t seem that the environment variable is getting set and the Token value for Auth on the test route is empty. Am I doing something wrong? Is there a recommended way to do this?

My goal is the have users of the docs call the /oath/token route and then be able to use all of the other endpoints without the need to copy and paste the token around to each.

Thank you,
Justin




image.png

After investigation, we found that the issue here is that the documentation does not support extraction and replacement of variables. You will need to manually fill in the actual values of variables before debugging. We recommend running debugging within the automated testing module in the software.

Thank you for the response.