How To Provide Bearer Token from an external Source (i.e. from a text file, json or out put of executble)

How To Provide Bearer Token from an external Source (i.e. from a text file, json or out put of executble)

Welcome to the community @post2vishwa

So I assume you are asking how to pass in this token? As long as the token hasn’t expired then this shouldn’t be an issue.

So depending on what you need there are a few ways to tackle this. The first would be straight up passing the value in though the collection runner via a Data file. You can find information on how to do that here - https://learning.getpostman.com/docs/postman/collection_runs/working_with_data_files

Next would be when making a single call. In this case you could set the value in an environment variable, as it would likely change from time to time. You can find more information on that here - https://learning.getpostman.com/docs/postman/environments_and_globals/intro_to_environments_and_globals

The last one would be if you need to make a call to the external source to generate the token for you. If it’s as simple as making a call to the source via an API request. Then you would simply make that call and then you could extract that token from the response, put it into a variable and reference it in your subsequent calls. The above link should provide you some info on that as well.

Hope this helps guide you in the right direction. Feel free to ask for clarification if you need some.