R/fs_get_auth.R

Defines functions fs_get_auth

# Helper function to get authentication
#
# The authentication environment is created by new.env function in the zzz.R file.  The authentication token 'oauth' is created by the figshare_auth function.  This helper function lets all other functions load the authentication.  
# @keywords internal
 fs_get_auth <- function(){
   if(!exists("oauth", envir=FigshareAuthCache))
     tryCatch(fs_auth(), error= function(e) 
       stop("Requires authentication. 
       Are your credentials stored in options? 
       See fs_auth function for details."))
   get("oauth", envir=FigshareAuthCache)
 }
# 
# 
# 
ropensci/rfigshare documentation built on May 18, 2022, 6:34 p.m.