Hi,
My code works locally but when I deploy to shiny it does not work.
I have connected to google cloud and trying upload and download files.
I am getting error when I deploy code to shiny which works fine on locally
Authentication options didn't match existing session token and not interactive session
so unable to manually reauthenticate
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Following is my code
GCS_AUTH_FILE="empjeson.json"
Project_Key <- "AIzaSyBg-b7_QUiwKjckTcF97oNh1qrMo5NnitY"
#App_Name <- "MySimpleCloudApp"
#BucketName <- "atulbucketmater"
#clientId <- "atulgoogleclientid"
CliendId_Key <- "237057174057-kih9hfvkqe49h9cffp34rkjsert4ek5u.apps.googleusercontent.com"
secret_Key <- "dXn0AFT_RqxwXRAqahYokCUG"
options(googleAuthR.client_id = "237057174057-kih9hfvkqe49h9cffp34rkjsert4ek5u.apps.googleusercontent.com", googleAuthR.client_secret = "dXn0AFT_RqxwXRAqahYokCUG")
gcs_auth(new_user=FALSE, no_auto= FALSE)
buckets <- ("emp_images")
#gcs_auth()
#gcs_get_global_bucket()
gcs_global_bucket("emp_images")
gcs_get_global_bucket()
bucket_info <- gcs_get_bucket("emp_images")
bucket_info
##############################################
library(RMySQL)
options(sqldf.driver = "SQLite")
options(mysql = list(
"host" = "35.200.205.167",
"port" = 3306,
"user" = "promotor",
"password" = "emp1234"
))
databaseName <- "emptest"
table <- "trn"
####################################################
my_username <- "test"
my_password <- "abc"
fields <- c( "Outlet", "Category", "Item", "Trn","Qty")
custfields <- c( "CustOutlet", "CustCategory", "CustItem", "Customer", "Agegroup", "Gender", "Mobile", "Location", "Quantity")
# which fields are mandatory
fieldsMandatory <- c( "Qty")
# add an asterisk to an input label
labelMandatory <- function(label) {
tagList(
label,
span("*", class = "mandatory_star")
)
}
# get current Epoch time
epochTime <- function() {
return(as.integer(Sys.time()))
}
# get a formatted string of the timestamp (exclude colons as they are invalid
# characters in Windows filenames)
humanTime <- function() {
format(Sys.time(), "%Y-%m-%d:%H%-%OS")
}
# save the results to a file
loadatt_images <- function() {
# Connect to the database
db <- dbConnect(MySQL(), dbname = databaseName, host = options()$mysql$host,
port = options()$mysql$port, user = options()$mysql$user,
password = options()$mysql$password)
# Construct the fetching query
table <-"att_images"
query <- sprintf("SELECT image FROM %s", table)
# Submit the fetch query and disconnect
data <- dbGetQuery(db, query)
dbDisconnect(db)
data
}
saveatt_images <- function(data) {
db <- dbConnect(MySQL(), dbname = databaseName, host = options()$mysql$host,
port = options()$mysql$port, user = options()$mysql$user,
password = options()$mysql$password)
table <-"att_images"
query <- sprintf( "INSERT INTO %s (%s) VALUES ('%s')",
table,
paste(names(data), collapse = ", "),
paste(data, collapse = "', '")
)
# print(query)
# Submit the update query and disconnect
dbGetQuery(db, query)
dbDisconnect(db)
}
l
ui <-fluidPage(
useShinyalert(),
tags$style(HTML("
.tabs-above > .nav > li[class=active] > a {
background-color: #FFFF00;
color: #FFF;
}")),
tags$style(HTML("
.tabbable > .nav > li > a {background-color: aqua; color:black}
.tabbable > .nav > li > a[data-value='t1'] {background-color: red; color:white}
.tabbable > .nav > li > a[data-value='t2'] {background-color: blue; color:white}
.tabbable > .nav > li > a[data-value='t3'] {background-color: green; color:white}
.tabbable > .nav > li[class=active] > a {background-color: black; color:white}
")),
# App title ----
tags$head(
tags$style(HTML("
@import url('//fonts.googleapis.com/css?family=Lobster|Cabin:400,700');
h1 {
font-family: 'Lobster', cursive;
font-weight: 500;
line-height: 1.1;
color: #48ca3b;
}
"))
),
titlePanel(" EMPORIO -RETAIL MITRA - DATA ANALYTIC AND ARTIFICIAL INTELIGENCE MOBILE APP"),
# Sidebar layout with input and output definitions ----
# Main panel for displaying outputs ----
conditionalPanel(
condition = "input.tabselected == 1"
),
mainPanel(width = 12,
tags$head(tags$style(type="text/css",
"#loadmessage {
position: fixed;
font-family: 'Areal' ;
top: 7%;
left: 65%;
ocacity: 0.50;
text-align: center;
font-weight: 500;
#font-weight: bold;
font-size: 100%;
color: #ad1d28;
z-index: 105;
animation: blinker 1s linear infinite;
}")),
#conditionalPanel(condition="$('html').hasClass('shiny-busy')",
tags$div("Developed by - Neel Analytics",id="loadmessage"),
tags$script(HTML("
(function blink() {
$('#loadmessage').fadeOut(1000).fadeIn(4000, blink);
})();
")),
# Output: Tabset w/ plot, summary, and table ----
textOutput("usernm1"),