googlesheets
needs to direct users to in
order to authenticate in a Web Server Application. This function is designed
for use in Shiny apps. In contrast, the default authorization sequence in
googlesheets
is appropriate for a user working directly with R on a
local computer, where the default handshakes between the local computer and
Google work just fine. The first step in the Shiny-based workflow is to form
the Google URL where the user can authenticate him or herself with Google.
After success, the response, in the form of an authorization code, is sent to
the redirect_uri
(see below) which gs_webapp_get_token
uses to exchange for an access token. This token is then stored in the usual
manner for this package and used for subsequent API requests.gs_webapp_auth_url(client_id = getOption("googlesheets.webapp.client_id"),
redirect_uri = getOption("googlesheets.webapp.redirect_uri"),
access_type = "online", approval_prompt = "auto")
redirect_uri
specific to your project. Inform googlesheets
of
this information by providing as function arguments or by defining these
options. For example, you can put lines like this into a Project-specific
.Rprofile
file:options("googlesheets.webapp.client_id" = MY_CLIENT_ID) options("googlesheets.webapp.client_secret" = MY_CLIENT_SECRET) options("googlesheets.webapp.redirect_uri" = MY_REDIRECT_URI)
Based on Google Developers' guide to
gs_webapp_get_token