Hi I am using AzureAuth to authenticate for R Shiny WebApp. I need current user email ID who is using the shiny webapp. Below is the code structure. The email ids for every time the app is open by the user must be stored. Current roadblock is only to get the user details. Since I am new to this could'nt find any examples which shows how to fetch the details using AzureAuth package features
load.lib <- c("AzureAuth","shiny","shinyjs","httr")
install.lib <- load.lib[!load.lib %in% installed.packages()]
for(lib in install.lib) install.packages(lib,dependencies=TRUE)
sapply(load.lib,library,character=TRUE)
######### Setting the local port ###############
redirect <- "http://localhost:8100"
port <- httr::parse_url(redirect)$port
options(shiny.port=if(is.null(port)) 80 else as.numeric(port))
######### Authentication #######################
tenant <- "your-tenant-here"
app <- "your-app-id-here"
resource <- "your-app-id-here"
token <- get_azure_token(resource, tenant, app, auth_type="authorization_code",
authorize_args=list(redirect_uri=redirect), version=2,
use_cache=FALSE)
###############Importing the app R files#########
# load ui elements
source("ui.R")
# load server function
source("server.R")
ui_func <- function(req)
{
opts <- parseQueryString(req$QUERY_STRING)
if(is.null(opts$code))
{
auth_uri <- build_authorization_uri(resource, tenant, app, redirect_uri=redirect, version=2)
redir_js <- sprintf("location.replace(\"%s\");", auth_uri)
tags$script(HTML(redir_js))
}
else ui
}
# Run the application
shinyApp(ui = ui_func, server = server)