EGA remote download via snakemake fails due to EGA_CLIENT_ID specification The example code provided by the Snakemake documentation for remote downloading from the EGA archive fails for me. I have defined all required environment variables, but an error comes up stating 

{"error":"invalid_client","error_description":"Bad client credentials"}


I guess I am not defining the EGA_CLIENT_ID variable correctly? I am using Snakemake 5.16 and Python 3.7.2. Thanks a lot in advance for your advice. 

Code: 

import snakemake.remote.EGA as EGA

ega = EGA.RemoteProvider()
os.environ["EGA_USERNAME"] = "XXX"
os.environ["EGA_PASSWORD"] = "XXX"
os.environ["EGA_CLIENT_SECRET"] = "XXX"
os.environ["EGA_CLIENT_ID"] = "pyega3"
rule a:
  input:
      ega.remote("ega/EGAD00001002142/COLO_829_EPleasance_TGENPipe.bam.bai")
  output:
      "data/COLO_829BL_BCGSC_IlluminaPipe.bam.bai"
  shell:
      "cp {input} {output}"
Okay, I finally solved it. The reason was the EGA_CLIENT_ID variable. In the pyega3.py script, there is a definition for the client_id for pyega3 v3.0.44 ("f20cd2d3-682a-4568-a53e-4262ef54c8f4"). After setting the EGA_CLIENT_ID to this value login was successful. 

os.environ["EGA_CLIENT_ID"] = "f20cd2d3-682a-4568-a53e-4262ef54c8f4"


I think this is a bug and I filed it on Snakemake's git repository - the official documentation just requires definition of the EGA_USERNAME and EGA_PASSWORD variables, and while definition of EGA_CLIENT_SECRET will probably need to be done by the user, the client ID should be pulled automatically from the pyega3 version installed locally. 

Of note, after successful login, the example download from the documentation failed with the following:

Missing input files for rule a:
ega/EGAD00001002142/COLO_829_EPleasance_TGENPipe.bam.bai


However, downloading files that I have access to worked, indicating that the paths to the files from the documentation are wrong or are access-protected.