fawda123 / rStrava

Functions to access data from Strava's v3 API.
154 stars 31 forks source link

object 'stoken' not found #86

Closed piercefa closed 1 year ago

piercefa commented 3 years ago

When I use the get_athlete function, I receive the following error: Error in as.request(config) : object 'stoken' not found

I enabled my google API and was following the "READ.ME".

I configured the 'stoken' and the athentication pops up as expected.

fawda123 commented 3 years ago

Are you creating the stoken as follows and using the stoken object created in your current R session environment for the functions?

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"))
piercefa commented 3 years ago

app_name <- 'XXX' # chosen by user app_client_id <- 'DDDDD' # an integer, assigned by Strava app_secret <- 'xxxxxxxxxx' # 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"))

The above is what I used - however I think it might be that I need to refresh my access token

From my strava API profile

expires at 2021-09-22T18:29:08+00:00

But I do not know how to refresh it or if this will solve my problem. When I 'authorize' it says that I have access but the error pops up in the R console.

Thanks for any insight!

fawda123 commented 3 years ago

Are the values you're using for app_name etc. the same ones from your previous message? These should be values given to you by Strava when you register an App on your own user console - should be specific integer and alphanumeric values. Guidance here: https://developers.strava.com/docs/getting-started/

piercefa commented 3 years ago

Yes they are specific to my app

Get Outlook for iOShttps://aka.ms/o0ukef


From: Marcus W Beck @.> Sent: Friday, September 24, 2021 7:49:50 AM To: fawda123/rStrava @.> Cc: FELDMEYER Alexandra @.>; Author @.> Subject: Re: [fawda123/rStrava] object 'stoken' not found (#86)

Are the values you're using for app_name etc. the same ones from your previous message? These should be values given to you by Strava when you register an App on your own user console - should be specific integer and alphanumeric values. Guidance here: https://developers.strava.com/docs/getting-started/https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdevelopers.strava.com%2Fdocs%2Fgetting-started%2F&data=04%7C01%7C%7C533da31aa81645d11ddf08d97f516b28%7Ce2bc9a15056d47f3889bffab9c512b17%7C0%7C0%7C637680809947110902%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=0No%2F%2Fd1iW4bKIiiC6lKzu6gL2f3P3L3O2804%2BvS17k0%3D&reserved=0

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ffawda123%2FrStrava%2Fissues%2F86%23issuecomment-926563751&data=04%7C01%7C%7C533da31aa81645d11ddf08d97f516b28%7Ce2bc9a15056d47f3889bffab9c512b17%7C0%7C0%7C637680809947120897%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=2fLEi%2Bj%2BOPAe0s2WWy%2BIOZwhuR1vxf79nKgJJiTbmRQ%3D&reserved=0, or unsubscribehttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FALNHFMPQXSJKTYSHNPTYUADUDRQV5ANCNFSM5EOOQ6YA&data=04%7C01%7C%7C533da31aa81645d11ddf08d97f516b28%7Ce2bc9a15056d47f3889bffab9c512b17%7C0%7C0%7C637680809947120897%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=SKTK7TAiKNRCj2Lw%2BJgpEVOJnYhAEgL0mRfkO1IGOiI%3D&reserved=0. Triage notifications on the go with GitHub Mobile for iOShttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7C%7C533da31aa81645d11ddf08d97f516b28%7Ce2bc9a15056d47f3889bffab9c512b17%7C0%7C0%7C637680809947130893%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=QzFmliRuaos1pLONbsQjFfzZspKQvPuHj5yjMn2C5%2BM%3D&reserved=0 or Androidhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26referrer%3Dutm_campaign%253Dnotification-email%2526utm_medium%253Demail%2526utm_source%253Dgithub&data=04%7C01%7C%7C533da31aa81645d11ddf08d97f516b28%7Ce2bc9a15056d47f3889bffab9c512b17%7C0%7C0%7C637680809947130893%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=C14YUICgHRqqSAXWwa2jkgkBE51solGFLMubSAaiWEk%3D&reserved=0.

fawda123 commented 3 years ago

Hm, sorry I'm not sure what the issue is. Have you tried creating a new app on the Strava website? Or using a different browser? It works for me on Chrome. Below is my session info if that helps.

- Session info -------------------------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 4.0.2 (2020-06-22)
 os       Windows 10 x64              
 system   x86_64, mingw32             
 ui       RStudio                     
 language (EN)                        
 collate  English_United States.1252  
 ctype    English_United States.1252  
 tz       America/New_York            
 date     2021-09-27                  

- Packages -----------------------------------------------------------------------------------------------------------------------------
 package     * version  date       lib source                                   
 askpass       1.1      2019-01-13 [1] CRAN (R 4.0.0)                           
 assertthat    0.2.1    2019-03-21 [1] CRAN (R 4.0.0)                           
 bitops        1.0-7    2021-04-24 [1] CRAN (R 4.0.5)                           
 blob          1.2.1    2020-01-20 [1] CRAN (R 4.0.2)                           
 callr         3.7.0    2021-04-20 [1] CRAN (R 4.0.5)                           
 cli           3.0.1    2021-07-17 [1] CRAN (R 4.0.2)                           
 colorspace    2.0-2    2021-06-24 [1] CRAN (R 4.0.5)                           
 crayon        1.4.1    2021-02-08 [1] CRAN (R 4.0.2)                           
 DBI           1.1.1    2021-01-15 [1] CRAN (R 4.0.3)                           
 desc          1.3.0    2021-03-05 [1] CRAN (R 4.0.5)                           
 devtools      2.3.1    2020-07-21 [1] CRAN (R 4.0.2)                           
 digest        0.6.28   2021-09-23 [1] CRAN (R 4.0.2)                           
 dplyr         1.0.7    2021-06-18 [1] CRAN (R 4.0.2)                           
 ellipsis      0.3.2    2021-04-29 [1] CRAN (R 4.0.5)                           
 evaluate      0.14     2019-05-28 [1] CRAN (R 4.0.0)                           
 fansi         0.5.0    2021-05-25 [1] CRAN (R 4.0.5)                           
 fastmap       1.1.0    2021-01-25 [1] CRAN (R 4.0.3)                           
 fs            1.5.0    2020-07-31 [1] CRAN (R 4.0.3)                           
 generics      0.1.0    2020-10-31 [1] CRAN (R 4.0.3)                           
 ggmap       * 3.0.0    2019-02-04 [1] CRAN (R 4.0.0)                           
 ggplot2     * 3.3.5    2021-06-25 [1] CRAN (R 4.0.5)                           
 glue          1.4.2    2020-08-27 [1] CRAN (R 4.0.2)                           
 gtable        0.3.0    2019-03-25 [1] CRAN (R 4.0.0)                           
 htmltools     0.5.2    2021-08-25 [1] CRAN (R 4.0.5)                           
 httpuv      * 1.6.3    2021-09-09 [1] CRAN (R 4.0.2)                           
 httr        * 1.4.2    2020-07-20 [1] CRAN (R 4.0.5)                           
 jpeg          0.1-9    2021-07-24 [1] CRAN (R 4.0.5)                           
 knitr         1.31     2021-01-27 [1] CRAN (R 4.0.4)                           
 later         1.3.0    2021-08-18 [1] CRAN (R 4.0.5)                           
 lattice       0.20-41  2020-04-02 [2] CRAN (R 4.0.2)                           
 lifecycle     1.0.1    2021-09-24 [1] CRAN (R 4.0.2)                           
 magrittr      2.0.1    2020-11-17 [1] CRAN (R 4.0.2)                           
 memoise       1.1.0    2017-04-21 [1] CRAN (R 4.0.0)                           
 munsell       0.5.0    2018-06-12 [1] CRAN (R 4.0.0)                           
 openssl       1.4.5    2021-09-02 [1] CRAN (R 4.0.2)                           
 pillar        1.6.2    2021-07-29 [1] CRAN (R 4.0.2)                           
 pkgbuild      1.2.0    2020-12-15 [1] CRAN (R 4.0.3)                           
 pkgconfig     2.0.3    2019-09-22 [1] CRAN (R 4.0.0)                           
 pkgload       1.2.2    2021-09-11 [1] CRAN (R 4.0.5)                           
 plyr          1.8.6    2020-03-03 [1] CRAN (R 4.0.0)                           
 png           0.1-7    2013-12-03 [1] CRAN (R 4.0.0)                           
 prettyunits   1.1.1    2020-01-24 [1] CRAN (R 4.0.0)                           
 processx      3.5.2    2021-04-30 [1] CRAN (R 4.0.5)                           
 promises      1.2.0.1  2021-02-11 [1] CRAN (R 4.0.2)                           
 ps            1.6.0    2021-02-28 [1] CRAN (R 4.0.4)                           
 purrr         0.3.4    2020-04-17 [1] CRAN (R 4.0.0)                           
 R6            2.5.1    2021-08-19 [1] CRAN (R 4.0.5)                           
 Rcpp          1.0.7    2021-07-07 [1] CRAN (R 4.0.2)                           
 RCurl         1.98-1.4 2021-08-17 [1] CRAN (R 4.0.5)                           
 remotes       2.2.0    2020-07-21 [1] CRAN (R 4.0.3)                           
 RgoogleMaps   1.4.5.3  2020-02-12 [1] CRAN (R 4.0.0)                           
 rjson         0.2.20   2018-06-08 [1] CRAN (R 4.0.0)                           
 rlang         0.4.11   2021-04-30 [1] CRAN (R 4.0.5)                           
 rmarkdown     2.8      2021-05-07 [1] CRAN (R 4.0.5)                           
 rprojroot     2.0.2    2020-11-15 [1] CRAN (R 4.0.2)                           
 rStrava     * 1.1.4    2021-09-07 [1] https://fawda123.r-universe.dev (R 4.0.5)
 scales        1.1.1    2020-05-11 [1] CRAN (R 4.0.0)                           
 sessioninfo   1.1.1    2018-11-05 [1] CRAN (R 4.0.0)                           
 sp            1.4-6    2021-09-08 [1] Github (rsbivand/sp@44b68b7)             
 stringi       1.7.4    2021-08-25 [1] CRAN (R 4.0.5)                           
 stringr       1.4.0    2019-02-10 [1] CRAN (R 4.0.0)                           
 testthat      3.0.4    2021-07-01 [1] CRAN (R 4.0.5)                           
 tibble        3.1.4    2021-08-25 [1] CRAN (R 4.0.5)                           
 tidyr         1.1.3    2021-03-03 [1] CRAN (R 4.0.4)                           
 tidyselect    1.1.1    2021-04-30 [1] CRAN (R 4.0.5)                           
 usethis       2.0.0    2020-12-10 [1] CRAN (R 4.0.3)                           
 utf8          1.2.2    2021-07-24 [1] CRAN (R 4.0.2)                           
 vctrs         0.3.8    2021-04-29 [1] CRAN (R 4.0.5)                           
 withr         2.4.2    2021-04-18 [1] CRAN (R 4.0.5)                           
 xfun          0.25     2021-08-06 [1] CRAN (R 4.0.2)                           
 XML           3.99-0.7 2021-08-17 [1] CRAN (R 4.0.5)                           
 xml2          1.3.2    2020-04-23 [1] CRAN (R 4.0.0)                           
 yaml          2.2.1    2020-02-01 [1] CRAN (R 4.0.0)                           

[1] C:/Users/mbeck/R/win-library/4.0
[2] C:/Program Files/R/R-4.0.2/library
piercefa commented 3 years ago

I think I need to refresh my access token. But I am unsure how to do that in R. I have seen a page describing a cURL request, but I have never done this in R and I am unsure if that is possible.