rtweet_user {rtweet}R Documentation

Authentication options

Description

Authenticate methods to use the Twitter API. See the instructions in vignette("auth", package = "rtweet").

Usage

rtweet_user(
  client_id = NULL,
  client_secret = NULL,
  api_key = client_id,
  api_secret = client_secret
)

rtweet_bot(api_key, api_secret, access_token, access_secret, app = "rtweet")

rtweet_app(bearer_token)

rtweet_bearer(client = NULL, scopes = NULL)

rtweet_oauth2(client = NULL, scopes = NULL)

Arguments

client_id, client_secret

Application OAuth client ID and client Secret. These are generally not required for rtweet_user() since the defaults will use the built-in rtweet app.

api_key, api_secret

API key and secret. Deprecated in favor of ⁠client_*⁠ arguments.

access_token, access_secret

Access token and secret.

app

Name of the application you are building.

bearer_token

App bearer token.

client

Which client app will be used, see rtweet_client() for details.

scopes

The permissions of the app, see set_scopes() for details. By default it uses the client's scopes. Provided here in case you want to modify them.

Details

There are four ways that you can authenticate with the Twitter API:

To use rtweet_app(), rtweet_bot() or rtweet_oauth2() you will need to create your own Twitter app following the instructions in vignette("auth", package = "rtweet"). 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.

Value

If the validation is successful the OAuth token. For rtweet_app() a rtweet_bearer.

Security

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 ask_pass that if possible uses askpass::askpass() to interactively safely prompt you for the values.

References

https://developer.twitter.com/en/docs/authentication/oauth-2-0/authorization-code

See Also

rtweet_client()

Other authentication: auth_as(), auth_get(), auth_save(), auth_setup_default()

Examples

## Not run: 
rtweet_app()

## End(Not run)

[Package rtweet version 2.0.0 Index]