Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update authentication to API key #23

Closed
munterfinger opened this issue Dec 21, 2019 · 1 comment
Closed

Update authentication to API key #23

munterfinger opened this issue Dec 21, 2019 · 1 comment
Assignees
Labels

Comments

@munterfinger
Copy link
Owner

@munterfinger munterfinger commented Dec 21, 2019

Here has updated the authentication process and changed from APP_ID and APP_CODE to a single API_KEY: https://developer.here.com/documentation/authentication/dev_guide/topics/api-key-credentials.html

This means the set_auth(), unset_auth(), .check_auth() and .add_auth() methods have to be adjusted.

Most important change will be add_auth(), probably:

.add_auth <- function(url) {
  api_key = Sys.getenv("HERE_API_KEY")
  .check_auth(api_key)
  paste0(
    url,
    "&api_key=",
    api_key)
}

Thanks for reporting: https://twitter.com/anders_elias/status/1208132508384137217

@munterfinger munterfinger self-assigned this Dec 21, 2019
@munterfinger
Copy link
Owner Author

@munterfinger munterfinger commented Dec 22, 2019

The methods set_auth() and unset_auth() are defunct and replaced by set_key() and unset_key() in cb419fa.

library(hereR)

# Set the API key
set_key("<YOUR API KEY>")

# ... and remove it
unset_key()

NOTE: .Deprecated() was skipped because the HERE API endpoints have also changed. This means that after updating the package to a version greater than 0.2.1 the authentication must be changed from APP_ID and APP_CODE to an API_KEY.

set_auth("app_id", "app_code")
#> Error: 'set_auth' is defunct.
#> Use 'set_key' instead.
#> See help("Defunct") and help("hereR-defunct").
unset_auth()
#> Error: 'unset_auth' is defunct.
#> Use 'unset_key' instead.
#> See help("Defunct") and help("hereR-defunct").
Session info
devtools::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value                       
#>  version  R version 3.6.1 (2019-07-05)
#>  os       macOS Catalina 10.15.1      
#>  system   x86_64, darwin15.6.0        
#>  ui       X11                         
#>  language (EN)                        
#>  collate  de_CH.UTF-8                 
#>  ctype    de_CH.UTF-8                 
#>  tz       Europe/Zurich               
#>  date     2019-12-22                  
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version    date       lib source        
#>  assertthat    0.2.1      2019-03-21 [1] CRAN (R 3.6.0)
#>  backports     1.1.5      2019-10-02 [1] CRAN (R 3.6.0)
#>  callr         3.4.0      2019-12-09 [1] CRAN (R 3.6.0)
#>  cli           2.0.0      2019-12-09 [1] CRAN (R 3.6.0)
#>  crayon        1.3.4      2017-09-16 [1] CRAN (R 3.6.0)
#>  desc          1.2.0      2018-05-01 [1] CRAN (R 3.6.0)
#>  devtools      2.2.1      2019-09-24 [1] CRAN (R 3.6.0)
#>  digest        0.6.23     2019-11-23 [1] CRAN (R 3.6.0)
#>  ellipsis      0.3.0      2019-09-20 [1] CRAN (R 3.6.0)
#>  evaluate      0.14       2019-05-28 [1] CRAN (R 3.6.0)
#>  fansi         0.4.0      2018-10-05 [1] CRAN (R 3.6.0)
#>  fs            1.3.1      2019-05-06 [1] CRAN (R 3.6.0)
#>  glue          1.3.1      2019-03-12 [1] CRAN (R 3.6.0)
#>  hereR       * 0.2.1.9000 2019-12-22 [1] local         
#>  htmltools     0.4.0      2019-10-04 [1] CRAN (R 3.6.0)
#>  knitr         1.26       2019-11-12 [1] CRAN (R 3.6.0)
#>  magrittr      1.5        2014-11-22 [1] CRAN (R 3.6.0)
#>  memoise       1.1.0      2017-04-21 [1] CRAN (R 3.6.0)
#>  pkgbuild      1.0.6      2019-10-09 [1] CRAN (R 3.6.0)
#>  pkgload       1.0.2      2018-10-29 [1] CRAN (R 3.6.0)
#>  prettyunits   1.0.2      2015-07-13 [1] CRAN (R 3.6.0)
#>  processx      3.4.1      2019-07-18 [1] CRAN (R 3.6.0)
#>  ps            1.3.0      2018-12-21 [1] CRAN (R 3.6.0)
#>  R6            2.4.1      2019-11-12 [1] CRAN (R 3.6.0)
#>  Rcpp          1.0.3      2019-11-08 [1] CRAN (R 3.6.0)
#>  remotes       2.1.0      2019-06-24 [1] CRAN (R 3.6.0)
#>  rlang         0.4.2      2019-11-23 [1] CRAN (R 3.6.0)
#>  rmarkdown     2.0        2019-12-12 [1] CRAN (R 3.6.0)
#>  rprojroot     1.3-2      2018-01-03 [1] CRAN (R 3.6.0)
#>  sessioninfo   1.1.1      2018-11-05 [1] CRAN (R 3.6.0)
#>  stringi       1.4.3      2019-03-12 [1] CRAN (R 3.6.0)
#>  stringr       1.4.0      2019-02-10 [1] CRAN (R 3.6.0)
#>  testthat      2.3.1      2019-12-01 [1] CRAN (R 3.6.0)
#>  usethis       1.5.1      2019-07-04 [1] CRAN (R 3.6.0)
#>  withr         2.1.2      2018-03-15 [1] CRAN (R 3.6.0)
#>  xfun          0.11       2019-11-12 [1] CRAN (R 3.6.0)
#>  yaml          2.2.0      2018-07-25 [1] CRAN (R 3.6.0)
#> 
#> [1] /Library/Frameworks/R.framework/Versions/3.6/Resources/library
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.