Skip to content
This repository has been archived by the owner on Oct 31, 2019. It is now read-only.

Commit

Permalink
Only attempts to authenticate if is.activeAzureContect() is TRUE #46
Browse files Browse the repository at this point in the history
  • Loading branch information
andrie committed Feb 12, 2017
1 parent dbd313b commit 1d3946f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion R/AzureAuthenticate.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,13 @@ azureAuthenticate <- function(azureActiveContext, tenantID, clientID, authKey, v
#' @family Resources
#' @export
azureCheckToken <- function(azureActiveContext) {
if (missing(azureActiveContext) || is.null(azureActiveContext)) return(NA)
if (is.null(azureActiveContext$EXPIRY))
stop("Not Authenticated: Use azureAuthenticate")

if (azureActiveContext$EXPIRY < Sys.time()) {
message("Azure Token Expired: Attempting automatic renewal")
azureAuthenticate(azureActiveContext)
}
return("OK")
return(TRUE)
}

0 comments on commit 1d3946f

Please sign in to comment.