Postman pre-request script does not set the variable for an access token

Hey there! First, I’d like to welcome you to the Postman community and congrats on your first post! :confetti_ball:

So the issue that you are most likely having here is that pm.sendRequest is an asynchronous function. This means that the code runs but is not completed before going on to the next line in your pre-request script. In other words, you are making the post request and that code is executing, however it is happening after the rest of your code that depends on a successful auth.

Here is one solution that I’ve used in the past to acomplish what you’re trying to do. Hope it helps! :smile: