-
Notifications
You must be signed in to change notification settings - Fork 198
Overhaul auth mechanism to support multiple tokens/auth mechanisms #542
Conversation
To do:
|
I can help with the several tokens I use. (Sorry I haven't reviewed the other PR, but I haven't found time to look at it in detail yet). |
Since the all questions were about auth and they should no longer come up
Removing a couple of now-uneeded uses along the way.
@llrs I think this is in a good place to try out / review now. It's a big PR so I'd suggest starting in @alexpghayes would also be useful to get your eyes on |
Is there a function that will display the available saved auth methods so that you can select between them / set a default one? In the auth vignette I currently see tools for creating and saving auth, but am less clear on how to manage multiple auth types at once. |
@alexpghayes what do you mean by manage multiple auth types? Do you mean multiple saved auth objects? |
I mean whether you're authorizing as bot, app, or user. For example, suppose I have two apps, and I use app 1 exclusively for data collection, but I used app 2 both to post tweets to my timeline interactively and occasionally in an automated way. Then I would conceivably have three different auth objects, which I would probably want to name: |
You'd switch between them using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall it is much easier now to know what is happening and the different use cases. Haven't had time to fully test it (or look into tests), but there are many comments.
vignettes/auth.Rmd
Outdated
- App authentication allows you to act as if you were a Twitter app. | ||
You can't perform operations that a user would (like posting a tweet or reading a DM), but in return you get higher rate limits on operations like searching for tweets. | ||
|
||
- Bot authentication allows you to create a fully automated Twitter bot that performs actions on its own behalf rather than on behalf of a human. | ||
|
||
In either case, you'll need to start by creating a Twitter app, so this vignette will first walk you through that process. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is more general and probably nothing we can solve or mitigate on this vignette. But as a user I need to think twice each time Twitter app is mentioned. Is this my app/developer access or is Twitter default one.
Also it might be worth to add why having our own twitter app can be meaningful so I would add also the sentences of the README here on the vignete:
Using your personal account is fine for casual use, but if you are trying to collect a lot of data it's a good idea to create your own twitter "app".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's two things missing here:
- An explanation of what a twitter app is
- Mentioning that rtweet comes with a special one built-in
Conflicts: NAMESPACE NEWS.md tests/testthat/test-get-my-timeline.R
Ok, I've taken another pass at it — |
I've taken a couple more passes through the docs |
Co-authored-by: alex hayes <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! There are several function that do not have the #' @return
tag, it would be nice if all of the functions would have it, but this can be added later.
Also the README hasn't been build with the latest changes, but as I'm sure it will change soon, it might not worth your time to spend on it.
NEWS.md
Outdated
- `get_token()` and `get_tokens()` have been deprecated in favour of | ||
`auth_get()`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that auth_list
exists, the news should point to auth_list()
+ auth_as()
R/bearer_token.R
Outdated
#' This is something you should instead perform in the Twitter developer | ||
#' portal. | ||
#' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it is worth linking to the dashboard: https://developer.twitter.com/en/portal/projects-and-apps
Fixes #469. Fixes #387.
I think this code is mostly done (although I do need to test it thoroughly). Most of the remaining work is to carefully deprecate the existing auth systems so that old code continues to work, but you are steered towards the new system.