Skip to content

Commit

Permalink
Remove renv. Add in debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
samanthacsik committed Oct 3, 2024
1 parent 878cfc3 commit 4fc89f4
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 4,045 deletions.
4 changes: 4 additions & 0 deletions R/scrape_strava.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ source("R/keys-from-env.R")
source("R/strava_authentication.R")
my_token <- retrieve_strava_token()

if (is.null(my_token)) {
stop("No Token Retrieved!")
}

#......................create strava token.......................
# my_token <- httr::config(token = strava_oauth(app_name, app_client_id, app_secret,
# app_scope = "activity:read_all",
Expand Down
13 changes: 12 additions & 1 deletion R/strava_authentication.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ refresh_strava_token <- function(refresh_token) {

retrieve_strava_token <- function() {
strava_refresh_token <- rawToChar(get_object(refresh_token_filename, bucket=strava_s3_bucket))

print(substr(strava_refresh_token, 1, 5))
strava_app <- httr::oauth_app("strava", key = app_client_id, secret = app_secret)

strava_end <-httr::oauth_endpoint(
Expand All @@ -31,6 +31,17 @@ retrieve_strava_token <- function() {

new_token <- refresh_strava_token(strava_refresh_token)

if (is.null(new_token)) {
print("No Token Provided from refresh!")
return(NULL)
}
print(ls(new_token))
if (is.null(new_token$refresh_token)) {
print("No Refresh Token found in response!")
return(NULL)
}


put_object(file = charToRaw(new_token$refresh_token), object=refresh_token_filename, bucket=strava_s3_bucket)

token <- httr::oauth2.0_token(
Expand Down
Loading

0 comments on commit 4fc89f4

Please sign in to comment.