Complete an interactive login to Imgur to generate an OAuth2.0 token
1 2 3
A graphics device function. Default is
Name of the file to be uploaded to imgur.com
A logical indicating whether to cache the OAuth2.0 token for use later on. If
Most operations in the package can be performed anonymously using the default package API key. In order to perform most account-specific operations it is necessary to use OAuth authentication, which can only be performed interactively via a web browser.
imgur_login returns an OAuth2.0 reference class object that can be passed as the
token argument to all other functions in the package.
The OAuth token is moderately long lived; the response object contains a timestamp indicating its expiration time. The token can be subsequently refreshed using the
cache = TRUE, the OAuth2.0 token is automatically cached in a file called “.httr-oauth” in the working directory. This token will then be loaded automatically the next time
imgur_login is called (even in a new R session). To override an existing cache, set
cache = FALSE.
An OAuth2.0 reference class object, returned by
Thomas J. Leeper
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
## Not run: # login interactively tkn <- imgur_login() # use token in the `imgur` device i <- imgur('png', token = tkn) hist(rnorm(20)) imgur_off(i) # reload previous token rm(tkn) # OAuth token is automatically stored by # `imgur_login` if `cache = TRUE` (the default) # It is reloaded by calling `imgur_login` tkn <- imgur_login() token$refresh() # refresh token ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.