Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Working Yahoo OAuth2.0 OOB flow
# Requires httr fork available here:
# https://github.com/ctrombley/httr
library(httr)
library(httpuv)
endpoint <- oauth_endpoint("get_request_token", "request_auth", "get_token",
base_url = "https://api.login.yahoo.com/oauth2")
app <- oauth_app("yahoo",
key = "YOUR_CLIENT_ID",
secret = "YOUR_SECRET",
redirect_uri = "oob")
token <- oauth2.0_token(endpoint, app, use_oob = TRUE, as_header = TRUE,
use_basic_auth = TRUE, cache = TRUE)
config <- httr::config(token = token)
teamId <- "YOUR_TEAM_ID"
url <- sprintf("https://fantasysports.yahooapis.com/fantasy/v2/team/%s?response=json", teamId)
res <- GET(url, config)
teamRoster <- content(res)
print(teamRoster)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment