Skip to content

Commit

Permalink
Merge pull request #50 from gongcastro/test
Browse files Browse the repository at this point in the history
Use keyring instead of .Renviron
  • Loading branch information
gongcastro authored Sep 4, 2024
2 parents 3f2940b + 310e3db commit 400e0bb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
8 changes: 2 additions & 6 deletions R/connect.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,14 @@ bvq_connect <- function(google_email = NULL,
# if key exists, use it to log in
tryCatch(
suppressWarnings(
formr::formr_connect(
email = formr_email,
password = password,
host = "https://formr.org/"
)
formr::formr_connect(keyring = "formr")
),
error = function(e) {
cli_abort(
strwrap(
prefix = " ",
initial = "",
"Could not connect to {.url https://formr.org/}. Please check your internet connection or make sure you have set the right formr password in a {.file .Renviron} file, under the name {.envvar FORMR_PWD}."
"Could not connect to {.url https://formr.org/}. Please check your internet connection or make sure you have set the right keyring as formr using {.code formr::formr_store_keys} (see vignettes)."
)
)
}
Expand Down
12 changes: 12 additions & 0 deletions vignettes/bvq-connect.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ knitr::opts_chunk$set(

BVQ is currently a developing package for internal use at the [Center for Brain and Cognititon](https://www.upf.edu/web/cbc) (CBC). For this reason, logging in requires a password that can be required by writing to the maintainer of this package ([[email protected]](mailto:[email protected])).

----

**EDIT**: Since a few versions of the formr R package---which bvq uses---it is encouraged to use keyring to provide passwords when connecting to formr. Following these guidelines, it is recommended to set a keyring for formr in each local machine where bvq will be used. Please, do so as follows:

```r
formr::formr_store_keys("formr")
```

When prompted, provide the apropriate email and password. These will be stored in the local machine, and will be retrieved by bvq whenever necessary without having to provide a password every time.

----

If you have already acquired the password, **please, do not include this password in your R scripts or anywhere they can accidentally be made public**. Instead, store the password as a variable named `FORMR_PWD` in the .Renviron file in your home or project directory. You can create or open a .Renviron file from your R console to include your newly acquired password using the `edit_r_environ()` from the [usethis](https://usethis.r-lib.org/) package:

```
Expand Down

0 comments on commit 400e0bb

Please sign in to comment.