auth_as: Set default authentication for the current session

Description Usage Arguments Value See Also Examples

View source: R/auth.R

Description

auth_as() sets up the default authentication mechanism used by all rtweet API calls. See rtweet_user() to learn more about the three available authentication options.

Usage

1
auth_as(auth = NULL)

Arguments

auth

One of the following options:

  • NULL, the default, will look for rtweet's "default" authentication which uses your personal twitter account. If it's not found, it will call auth_setup_default() to set it up.

  • A string giving the name of a saved auth file made by auth_save().

  • An auth object created by rtweet_app(), rtweet_bot(), or rtweet_user().

Value

Invisibly returns the previous authentication mechanism.

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
# Use app auth for the remainder of this session:
my_app <- rtweet_app()
auth_as(my_app)

# Switch back to the default user based auth
auth_as()

# Load auth saved by auth_save()
auth_as("my-saved-app")

## End(Not run)

mkearney/rtweet documentation built on Sept. 29, 2021, 12:01 p.m.