authorize() function uses oauth2.0_token to obtain the OAuth tokens. Expired tokens will be refreshed automamaticly. If you have no client.id and client.secret the package provides predefined values.
authorize(username = getOption("rga.username"), client.id = getOption("rga.client.id"), client.secret = getOption("rga.client.secret"), cache = getOption("rga.cache"), reauth = FALSE, token = NULL)TRUE means to cache using the default cache file .oauth-httr, FALSE means not to cache. A string means to use the specified path as the cache file. Otherwise will be used the rga.cache option value (.ga-token.rds by default). If username argument specified token will be cached in the .username-token.rds file.TRUE to reauthorization with the same or different Google Analytics account.Token2.0 object (icluding TokenServiceAccount) to setup directly.Token2.0 object containing all the data required for OAuth access.
client.id and client.secret arguments directly in the authorize() function call
  rga.client.id and rga.client.secret options into the R session
When the authorize() function is used the Token variable is created in the separate .RGAEnv environment which is not visible for user. So, there is no need to pass the token argument to any function which requires authorization every time. Also there is a possibility to store token in separate variable and to pass it to the functions. It can be useful when you are working with several accounts at the same time.
username, client.id and client.secret params can be specified by an appropriate options (with RGA prefix): RGA_USERNAME, RGA_CLIENT_ID, RGA_CLIENT_SECRET.
oauth_app oauth2.0_token Token-classTo revoke all tokens: revoke_all
Setup environment variables: Startup
## Not run: 
# authorize(client.id = "my_id", client.secret = "my_secret")
# # if set RGA_CLIENT_ID and RGA_CLIENT_SECRET environment variables
# authorize()
# # assign token to variable
# ga_token <- authorize(client.id = "my_id", client.secret = "my_secret")
# ## End(Not run)
Run the code above in your browser using DataLab