Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example of an httr oauth for the yahoo APIs
library(httr)
# 1. Find OAuth settings for yahoo:
# Endpoints described here...
# http://developer.yahoo.com/oauth/guide/oauth-auth-flow.html
yahoo <- oauth_endpoint("get_request_token", "request_auth", "get_token",
base_url = "https://api.login.yahoo.com/oauth/v2/")
# 2. Register an application at...
# https://developer.apps.yahoo.com/dashboard/createKey.html
# Insert your values below - if secret is omitted, it will look it up in
# the YAHOO_CONSUMER_SECRET environmental variable.
myapp <- oauth_app("yahoo", key = "consumer.key here",
secret= "consumer.secret here")
# 3. Get OAuth credentials
token <- oauth1.0_token(yahoo, myapp)
# 4. Generate signature and make requests
sig <- sign_oauth1.0(myapp, token$oauth_token, token$oauth_token_secret)
GET("http://fantasysports.yahooapis.com/fantasy/v2/league/223.l.431/standings",
sig)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.