Learn R Programming

shinyga (version 0.1.2.9001)

shinygaGetTokenURL: Returns the authentication URL

Description

Returns the authentication URL

Usage

shinygaGetTokenURL(state, client.id = CLIENT_ID, client.secret = CLIENT_SECRET, redirect.uri = CLIENT_URL, scope = c("https://www.googleapis.com/auth/analytics", "https://www.googleapis.com/auth/analytics.readonly", "https://www.googleapis.com/auth/analytics.manage.users.readonly"))

Arguments

state
A string you pass to check authentication is correct.
client.id
The client ID taken from the Google API Console.
client.secret
The client secret taken from the Google API Console.
redirect.uri
The URL of where your Shiny application sits, that will read state parameter.
scope
Vector of URLs for the Google API you want to activate. Will be encoded. Defaults to c("https://www.googleapis.com/auth/analytics", "https://www.googleapis.com/auth/analytics.readonly")

Value

The URL a user should click on to start authentication.

See Also

Shortcut using doAuthMacro.

Other authentication functions: authReturnCode; createCode; doAuthMacro; shinygaGetToken

Examples

Run this code
## Not run: 
# securityCode <- createCode()
# shinyServer(function(input, output, session)){
# 
#   AuthCode <- reactive({
# 
#       authReturnCode(session, securityCode)
# 
#   })
# 
#   output$AuthGAURL <- renderUI({
# 
#        a("Click Here to Authorise Your Google Analytics Access",
#           href=ShinyGetTokenURL(securityCode)
#           )
#        })
# 
#   AccessToken <- reactive({
#       validate(
#         need(AuthCode(), "Authenticate To See")
#       )
# 
#       access_token <- ShinyGetToken(code = AuthCode())
# 
#       token <- access_token$access_token
# 
#     })
# }
# ## End(Not run)

Run the code above in your browser using DataLab