Skip to content
This repository has been archived by the owner on Nov 10, 2024. It is now read-only.

Commit

Permalink
Minor tweaks to the visualization
Browse files Browse the repository at this point in the history
  • Loading branch information
llrs committed Mar 29, 2023
1 parent 403c81f commit b484bcf
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions vignettes/auth.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,11 @@ This functions will need you to first set up a client, which requires your clien

You can get them in your [developer dashboard](https://developer.twitter.com/en/portal/dashboard) after selecting your app, you first need to fill the details of the "User authentication settings":

**App permissions**: Read, Read and write, or Read and write and Direct message
**Type of App**: Native app
**App info**
Callback URI: http://127.0.0.1:1410/
Choose one of the **App permissions**: Read, Read and write, or Read and write and Direct message
In **Type of App** select Native app
In **App info** set the callback URI to: http://127.0.0.1:1410/

The callback URI is important as this is what rtweet will use to validate.

The clients are under "Key and tokens" tab, check the top.
At the last section of the tab, there is the section \"Auth 2.0 Client ID and Client Secret\":
Expand All @@ -99,10 +100,8 @@ At the last section of the tab, there is the section \"Auth 2.0 Client ID and Cl
Use them to set up your client app:
```{r client}
client <- rtweet_client()
client_save(client)
client_as(client)
```{r client, eval = FALSE}
client <- rtweet_client(app = "my app")
```
Once you get your client you'll need to tell rtweet to use it (that's why we use `client_as()`).
Expand Down Expand Up @@ -147,7 +146,7 @@ But you'll need more data --- as well as the *API key* and *API secret* you reco
Again, you'll want to record this data in a secure place because you only get to see it once.
## Default auth
## Default
Now you have an auth object that you can provide to the `token` argument of any rtweet function:
Expand All @@ -162,6 +161,13 @@ Instead, you can call `auth_as()` to set this as the default for the remainder o
auth_as(auth)
```
Similarly you can use by default a client.
```{r, eval = FALSE}
client_as(client)
```
## Saving and loading {#save}
`auth_as()` only lasts for a single session; if you close and re-open R, you'd need to repeat the whole process (generate the tokens and pass them to `rtweet_user()`, `rtweet_app()` or `rtweet_bot()`).
Expand All @@ -185,6 +191,14 @@ If you use an authentication saved on a different path you can directly use it `
`auth_setup_default()` saves the authentication as default.
So, after your initial setup you can start all your scripts with `auth_as("default")` to load it.
Clients work similarly, but the client will be saved with the name of the app you provided:
```{r, eval=FALSE}
client_save(client)
client_as("myapp")
```
### On continuous integration workflows
On continuous integration you need to provide the keys and tokens as secret variables.
Expand Down

0 comments on commit b484bcf

Please sign in to comment.