Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reddit example #363

Closed
hadley opened this issue Apr 25, 2016 · 1 comment
Closed

Add reddit example #363

hadley opened this issue Apr 25, 2016 · 1 comment

Comments

@hadley
Copy link
Member

hadley commented Apr 25, 2016

library(httr)
library(purrr)

app <- oauth_app("reddit", "bvmjj2EOBvOknQ", "n8ueSvTNdlE0BDDJpLljvmgUGUw")
reddit <- oauth_endpoint(
  authorize = "https://www.reddit.com/api/v1/authorize",
  access = "https://www.reddit.com/api/v1/access_token"
)

token <- oauth2.0_token(reddit, app, scope = "read modposts", use_basic_auth = TRUE)
@hadley hadley closed this as completed in f94fd0a May 20, 2016
@muschellij2
Copy link
Contributor

This is currently giving

Error in init_oauth2.0(self$endpoint, self$app, scope = self$params$scope,  : 
  Too Many Requests (RFC 6585) (HTTP 429). Failed to get an access token.

I think it's because the User-Agent is using the default from Reddit, which gets throttled quickly. Is it possible to add User-Agent to the header of oauth2.0_token? I can't pass using user_params, even if as_header = TRUE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants