mikejohnson51 / hydrofab

Hydrofabric Fabricator
Creative Commons Zero v1.0 Universal
9 stars 4 forks source link

Call `get_hydrofabric` without a ScienceBase account? #27

Open lucyrandrews opened 1 year ago

lucyrandrews commented 1 year ago

For the function get_hydrofabric, would it be possible to call sbtools download functions or download functions from other packages that don't require a user to authenticate with a ScienceBase account?

get_hydrofabric calls sbtools::item_file_download, which requires authentication and session validation. As someone who doesn't work for DOI or have a close USGS collaborator, I don't have a ScienceBase account, so I can't use get_hydrofabric to download hydrofabric objects. There are certainly ways to work around this as a user (e.g. customizing functions as a user or just downloading directly from a ScienceBase link), but I just thought I'd toss this out there as a suggestion in case others are running into this!

What I see on my end:

hydrofab::get_hydrofabric(VPU = "18", type = "reference", dir = here("data-raw"), overwrite = TRUE)

retrieving S3 URL
Error in value[[3L]](cond) : 
  Error downloading [my filepath] Original error: 
 Error in get_access_token(): no token found, must call authenticate_sb()

sbtools::authenticate_sb()

Please enter your username:
Error in sbtools::authenticate_sb() : Empty username supplied, stopping

Thanks for considering!