strava_oauth {rStrava} | R Documentation |
Generata Strava API authentication token
Description
Generate a token for the user and the desired scope. The user is sent to the strava authentication page if he/she hasn't given permission to the app yet, else, is sent to the app webpage.
Usage
strava_oauth(
app_name,
app_client_id,
app_secret,
app_scope = "public",
cache = FALSE
)
Arguments
app_name |
chr string for name of the app |
app_client_id |
chr string for ID received when the app was registered |
app_secret |
chr string for secret received when the app was registered |
app_scope |
chr string for scope of authentication, Must be "read" , "read_all", "profile:read_all", "profile:write", "activity:read", "activity:read_all" or "activity:write" |
cache |
logical to cache the token |
Details
The app_name
, app_client_id
, and app_secret
are specific to the user and can be obtained by registering an app on the Strava API authentication page: http://strava.github.io/api/v3/oauth/. This requires a personal Strava account.
Value
A Token2.0
object returned by oauth2.0_token
to be used with API function calls
Examples
## Not run:
app_name <- 'myappname' # chosen by user
app_client_id <- 'myid' # an integer, assigned by Strava
app_secret <- 'xxxxxxxx' # an alphanumeric secret, assigned by Strava
# create the authentication token
stoken <- httr::config(
token = strava_oauth(
app_name,
app_client_id,
app_secret,
app_scope="activity:read_all"
)
)
# use authentication token
get_athlete(stoken, id = '2837007')
## End(Not run)