Description Usage Arguments Security See Also
There are three ways that you can authenticate with the twitter API:
rtweet_user()
interactively authenticates an existing twitter user.
This form is most appropriate if you want rtweet to control your
twitter account.
rtweet_app()
authenticates as a twitter application. An application can't
perform actions (i.e. it can't tweet) but otherwise has generally higher
rate limits (i.e. you can do more searches). See details
at https://developer.twitter.com/en/docs/basics/rate-limits.html.
This form is most appropriate if you are collecting data.
rtweet_bot()
authenticates as bot that takes actions on behalf of an app.
This form is most appropriate if you want to create a twitter account that
is run by a computer, rather than a human.
To use rtweet_app()
or rtweet_bot()
you will need to create your own
Twitter app following the instructions in vignette("auth.Rmd")
.
rtweet_user()
can be used with your own app, but generally there is
no need to because it uses the Twitter app provided by rtweet.
Use auth_as()
to set the default auth mechanism for the current session,
and auth_save()
to save an auth mechanism for use in future sessions.
1 2 3 4 5 6 7 8 9 10 | rtweet_user(api_key = NULL, api_secret = NULL)
rtweet_bot(
api_key = ask_pass("API key"),
api_secret = ask_pass("API secret"),
access_token = ask_pass("access token"),
access_secret = ask_pass("access token")
)
rtweet_app(bearer_token = ask_pass("bearer token"))
|
api_key, api_secret |
Application API key and secret. These are
generally not required for |
access_token, access_secret |
Access token and secret. |
bearer_token |
App bearer token. |
All of the arguments to these functions are roughly equivalent to
passwords so should generally not be typed into the console (where they
the will be recorded in .Rhistory
) or recorded in a script (which is
easy to accidentally share). Instead, call these functions without arguments
since the default behaviour is to use askpass::askpass()
to interactively
prompt you for the values.
Other authentication:
auth_as()
,
auth_get()
,
auth_save()
,
auth_setup_default()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.