Sage-Bionetworks / synapser

An R package providing programmatic access to Synapse
Apache License 2.0
32 stars 21 forks source link

Can't log in with .synapseConfig #330

Open lopierra opened 6 months ago

lopierra commented 6 months ago

Operating system

Windows 11 My Home directory is a OneDrive (ugh) folder, not sure if that is relevant

Description of the problem

I just installed the latest {synapser} on my new laptop. I got a personal auth token from Synapse and created a .synapseConfig file in my Home directory, but synLogin() returns Error in value[[3L]](cond) : No credentials provided.

I am able to log in with synLogin(authToken = "<my_token>") so the token seems to be working.

My .synapseConfig file looks like this:

[authentication]
authtoken = eyJ0eXAiOiJKV1QiLCJra..etc. [no quotes]

Output of sessionInfo()

R version 4.3.2 (2023-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 11 x64 (build 22631)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.utf8  LC_CTYPE=English_United States.utf8   
[3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.utf8    

time zone: America/Los_Angeles
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] synapser_2.0.0.200

loaded via a namespace (and not attached):
 [1] utf8_1.2.4        codetools_0.2-19  Matrix_1.6-1.1    lattice_0.21-9   
 [5] rjson_0.2.21      reticulate_1.35.0 glue_1.7.0        png_0.1-8        
 [9] lifecycle_1.0.4   cli_3.6.2         fansi_1.0.6       vctrs_0.6.5      
[13] grid_4.3.2        compiler_4.3.2    rstudioapi_0.15.0 tools_4.3.2      
[17] pillar_1.9.0      Rcpp_1.0.12       rlang_1.1.3       jsonlite_1.8.8   
lopierra commented 6 months ago

Also, hiii 👋 😁

thomasyu888 commented 6 months ago

Hi @lopierra! Good to see you here.

Ah, sorry for the troubles! We have had troubles with OneDrive in the past as it's a 'virtual' file system - not sure that will work. Instead of using the config file, can you try setting a system environmental variable. Id have to look at what that looks like on Windows but on a Mac terminal.

export  SYNAPSE_AUTH_TOKEN=...

I'll have the team take a closer look on Monday when we are back in.

lopierra commented 6 months ago

I think that worked - thanks @thomasyu888 !

In my Home directory (the OneDrive folder), I created a .Renviron file with SYNAPSE_AUTH_TOKEN=... Restarted R and am now able to log in using synLogin()

No idea why it couldn't find my .synapseConfig file but seems to be able to find the .Renviron file 🤷

thomasyu888 commented 6 months ago

I think that worked - thanks @thomasyu888 !

In my Home directory (the OneDrive folder), I created a .Renviron file with SYNAPSE_AUTH_TOKEN=... Restarted R and am now able to log in using synLogin()

No idea why it couldn't find my .synapseConfig file but seems to be able to find the .Renviron file 🤷

Awesome! I'll make sure to create a ticket so we add this to the documentation for OneDrive users.

Can it find the synapse cache folder?

lopierra commented 6 months ago

Not sure - where do I find that?

thomasyu888 commented 6 months ago

Not sure - where do I find that?

Can you try downloading a file with synapser? It will download a file somewhere onto your drive (maybe OneDrive) just wanted to make sure it works.

lopierra commented 6 months ago
test_download <- synGet("syn51216461")
test_download$path

resulted in

[1] "c:\\users\\lopi\\.synapsecache\\340\\124656340\\all_cohorts_study_2023-05-17.csv"

That's on my local machine - my "Home" folder according to Sys.getenv("R_USER") is

C:/Users/lopi/OneDrive - The University of Colorado Denver/Documents

But regardless, it is saving it to synapse cache, so I think that's working properly?