Global variables in Authorization username and password


Noob question from someone just starting to use Katalon Studio for API testing.
I am using basic Authorization for each request. The username and password is the same for all requests, however in the future it may change. When it does, I don’t want to go through each request and update it with the new username and password.

How can I do this? Can I use Global Variables for username and password?


Yes you can. Many ways to do this but one method is this:

You have profile global variables, you can also call in variables from a spreadsheet which can be a file such as excel or a locally built one.

Hello @B_L

Thank you for confirming there is a way to to do this,
what is the syntax required?
ive tried the following with no succes:

Ive also tried other combinations making sure ived added them to the variables tab.

Found a work around, just saved the authentication token to a variable. and made use of different variables for different environments.

1 Like

But how did you use the variables in the username and password text boxes?

You can use variables only in HTTP Header for this purpose.
The Authorization tab is only a helper to create/update this value.
Since you are asking for username:password I guess you are using Basic authentication.

To use a Global Variable in this scope, you must first create one, let’s say with the name credentials
Now you have to create an Authorization header field with a value like Basic ${GlobalVariable.credentials}

The value of the credentials variable must be the base64 encoding of the username:password string.

Or you can save the entire Basic (*blah(£" string to a variable if it is more convenient to you (and use the Authorization tab to quickly generate it)


1 Like