Authenticate with a Mastodon instance
auth_setup(
instance = NULL,
type = NULL,
name = NULL,
path = NULL,
clipboard = FALSE,
verbose = TRUE,
browser = TRUE
)
A bearer token
a public instance of Mastodon (e.g., mastodon.social).
Either "public" to create a public authentication or "user" to create authentication for your user (e.g., if you want to post from R or query your followers).
give the token a name, in case you want to store more than one.
path to store the token in. The default is to store tokens in the
path returned by tools::R_user_dir("rtoot", "config")
.
logical, whether to export the token to the clipboard
logical whether to display messages
if TRUE
(default) a browser window will be opened to authenticate, else the URL will be provided so you can copy/paste this into the browser yourself
If either name
or path
are set to FALSE
, the token is only
returned and not saved. If you would like to save your token as an environment variable,
please set clipboard
to TRUE
. Your token will be copied to clipboard in the environment variable
format. Please paste it into your environment file, e.g. ".Renviron", and restart
your R session.
verify_credentials()
, convert_token_to_envvar()
if (FALSE) {
auth_setup("mastodon.social", "public")
}
Run the code above in your browser using DataLab