if (FALSE) {
# request a token
auth() # this will guide you through all steps
# the token is stored in the location returned by this command
file.path(tools::R_user_dir("atrrr", "cache"),
Sys.getenv("BSKY_TOKEN", unset = "token.rds"))
# to use a different than the default file name for the token, set BSKY_TOKEN
Sys.setenv(BSKY_TOKEN = "identity-2.rds")
# now either rename your token file or request a new token
auth()
# the cache now contains two tokens
list.files(tools::R_user_dir("atrrr", "cache"))
# functions that interact with the API also take a .token argument with the
# path. For example:
tok_path <- file.path(tools::R_user_dir("atrrr", "cache"), "identity-2.rds")
get_skeets_authored_by(actor = "benguinaudeau.bsky.social", parse = TRUE,
.token = tok_path)
}
Run the code above in your browser using DataLab