Publishing Shiny App to connect : Unauthorized 401

I am new to shiny and have issues publishing the app.The app gets deployed with no errors but throws an error after deployment.

Error : 
Error in value[[3L]](cond) : Unauthorized (HTTP 401).
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted

Output :

sessionInfo() : 
R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin18.6.0 (64-bit)
Running under: macOS Mojave 10.14.3

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /usr/local/Cellar/openblas/0.3.7/lib/libopenblasp-r0.3.7.dylib

[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] shinyEventLogger_0.1.1 shinycssloaders_0.2.0  shinydashboard_0.7.1   data.table_1.12.2     
[5] dplyr_0.8.3            httr_1.4.1             rjson_0.2.20           shiny_1.3.2           

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.2        pillar_1.4.2      compiler_3.6.1    later_0.8.0       bupaR_0.4.2       plyr_1.8.4       
 [7] R.methodsS3_1.7.1 forcats_0.4.0     R.utils_2.9.0     tools_3.6.1       packrat_0.5.0     zeallot_0.1.0    
[13] digest_0.6.20     jsonlite_1.6      lifecycle_0.1.0   tibble_2.1.3      pkgconfig_2.0.2   rlang_0.4.0      
[19] rstudioapi_0.10   crosstalk_1.0.0   yaml_2.2.0        curl_4.0          stringr_1.4.0     askpass_1.1      
[25] htmlwidgets_1.3   vctrs_0.2.0       DT_0.8            tidyselect_0.2.5  mongolite_2.1.0   glue_1.3.1       
[31] R6_2.4.0          eventdataR_0.2.0  purrr_0.3.2       tidyr_1.0.0       magrittr_1.5      backports_1.1.4  
[37] promises_1.0.1    htmltools_0.3.6   rsconnect_0.8.15  assertthat_0.2.1  mime_0.7          xtable_1.8-4     
[43] httpuv_1.5.1      stringi_1.4.3     miniUI_0.1.1.1    openssl_1.4.1     crayon_1.3.4      R.oo_1.22.0.

The 401 error is an authorization error. Without knowing much it suggests your app wasn’t deployed in a way that a data source could authenticate your app.

Where’s the data coming from the app?

In terms of a general docs on connecting a app to a database, check out

The data is coming from an external source for the app. I get the data using an api to an internal database we have.

basic_url = ""
base_url = paste0(basic_url,"protocols")
run_url_individual = paste0(basic_url,"runs/")
slurp_url = paste0(basic_url,"slurps")
response<-GET(base_url, add_headers(.headers = c("X-CDD-Token"=TOKEN)))
request <- stop_for_status(response)
get_protocols_json <- fromJSON(content(response, as = 'text'))

Snippet of how i am getting the data