Last active
November 8, 2018 05:56
-
-
Save ctrombley/296c2d9eb2738642b953debfc7404b12 to your computer and use it in GitHub Desktop.
Working Yahoo OAuth2.0 OOB flow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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