The Gam executable directory is separate from the Gam configuration directory and there is a configuration file that contains all Gam settings.
For these examples, the Gam executable directory is C:\GAM and the Gam configuration directory is C:\GamCfg.
Example 1: Three clients with distinct client_secrets.json, oauth2service.json and oauth2.txt files.
There are three subdirectories under C:\GamCfg each containing client_secrets.json, oauth2service.json and oauth2.txt files.
C:\GamCfg\ClientA
C:\GamCfg\ClientB
C:\GamCfg\ClientC
These are the relevant portions of gam.cfg
[DEFAULT]
config_dir = C:\GamCfg
client_secrets_json = client_secrets.json
oauth2_txt = oauth2.txt
oauth2service_json = oauth2service.json
section = ClientA
[ClientA]
customer_id = Caaa11111
config_dir = ClientA
[ClientB]
customer_id = Cbbb22222
config_dir = ClientB
[ClientC]
customer_id = Cccc33333
config_dir = ClientC
The config_dir setting in each [ClientX] section is relative and is appended to the config_dir setting in the [DEFAULT] section.
Example 2: Three clients with common client_secrets.json and oauth2service.json files and distinct oauth2.txt files.
The C:\GamCfg directory contains the common client_secrets.json and oauth2service.json files.
There are three subdirectories under C:\GamCfg each containing a distinct oauth2.txt file.
C:\GamCfg\ClientA
C:\GamCfg\ClientB
C:\GamCfg\ClientC
Theee are the relevant portions of gam.cfg
[DEFAULT]
config_dir = C:\GamCfg
client_secrets_json = client_secrets.json
oauth2_txt = oauth2.txt
oauth2service_json = oauth2service.json
section = ClientA
[ClientA]
customer_id = Caaa11111
oauth2.txt = ClientA\oauth2.txt
[ClientB]
customer_id = Cbbb22222
oauth2.txt = ClientB\oauth2.txt
[ClientC]
customer_id = Cccc33333
oauth2.txt = ClientC\oauth2.txt
Your main client is ClientA as specified in [DEFAULT] section = ClientA.
To get information about your main client, don't select a section.
gam info domain
Customer ID: Caaa11111
...
To get information about another client, select a section.
gam select ClientB info domain
Customer ID: Cbbb22222
...
gam select ClientC info domain
Customer ID: Cccc33333
...
Suppose you want to work with ClientB for a while, then switch to ClientC but don't want to keep typing gam select.
gam select ClientB save
GAM sets section = ClientB in the DEFAULT section, updates gam.cfg, selects ClientB for this and subsequent gam commands so you don't have to use select <Section> argument.
gam info user admin
...
When it's time to switch to ClientC, select and save the section.
gam select ClientC save
GAM sets section = ClientC in the DEFAULT section, updates gam.cfg, selects ClientC for this and subsequent gam commands so you don't have to use select <Section> argument.
gam info user admin
...
If you have to switch to ClientA for a single command, select ClientA, but don't save it, further commands without a select will be ClientC.
gam select ClientA info user admin
...
gam info user admin
...