get_smarter_token | R Documentation |
Authenticate through SMARTER API and returns a valid token. Token is also cached in package in order to be used by other functions. Calling this function another time will return the cached token if is still valid
get_smarter_token( username = Sys.getenv("SMARTER_API_USERNAME"), password = Sys.getenv("SMARTER_API_PASSWORD") )
username |
the SMARTER username (or 'SMARTER_API_USERNAME' environment variable) |
password |
the SMARTER password (or 'SMARTER_API_PASSWORD' environment variable) |
Returns a valid token as a string
In order to not provide your SMARTER credentials within your code, you could
set those values in your environment. You can call
usethis::edit_r_environ()
in order to track credentials in your
.Renviron file using the Key=value
syntax, for example:
SMARTER_API_USERNAME=<smarter username> SMARTER_API_PASSWORD=<smarter password>
See Managing R with .Rprofile, .Renviron, Rprofile.site, Renviron.site, rsession.conf, and repos.conf for more information
SMARTER credentials MUST NOT be tracked in your code
token <- get_smarter_token() ## Not run: token <- get_smarter_token(username, password) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.