trakt_credentials
searches for your credentials and stores them
in the appropriate environment variables of the same name.
To make this work automatically, place your key as environment variables in
~/.Renviron
(see Details
).
Arguments to this function take precedence over any configuration file.
Arguments
- username
character(1)
: Explicitly set your trakt.tv username (optional).- client_id
character(1)
: Explicitly set your API client ID (required for any API interaction).- client_secret
character(1)
: Explicitly set your API client secret (required only for authenticated API interaction).- silent
logical(1) [TRUE]
: No messages are printed showing you the API information. Mostly for debug purposes.
Value
Invisibly: A list
with elements username
, client_id
and client_secret
,
where values are TRUE
if the corresponding value is non-empty.
Details
This function is called automatically when the package is loaded via library(tRakt)
or tRakt::fun
function calls – you basically never have to use it if you have
stored your credentials as advised.
Additionally, for regular (non-authenticated) API interaction, you do not have to
set any credentials at all because the package's client_secret
is used as a fallback,
which allows you to use most functions out of the box.
Set appropriate values in your ~/.Renviron
like this:
If (and only if) the environment option trakt_client_secret
is set to a non-empty
string (i.e. it's not ""
), then all requests will be made using authentication.
See also
Other API-basics:
trakt_get()
,
trakt_get_token()
Examples
if (FALSE) { # \dontrun{
# Use a values set in ~/.Renviron in an R session:
# (This is automatically executed when calling library(tRakt))
trakt_credentials(silent = FALSE)
# Explicitly set values in an R session, overriding .Renviron values
trakt_credentials(
username = "jemus42",
client_id = "totallylegitclientsecret",
silent = FALSE
)
} # }