Skip to content
Snippets Groups Projects
Commit 0a6b4cbe authored by Azadpour, Elmera's avatar Azadpour, Elmera
Browse files

add sciencebase login steps

parent 88c4e277
No related branches found
No related tags found
1 merge request!90Add raster maps
......@@ -16,7 +16,7 @@ This project:
## Running the targets pipeline in R
Clone the repo. In RStudio, run `library(targets)` and `tar_make()`. This will require `tidycensus` credentialing to run, see instructions below.
Clone the repo. In RStudio, run `library(targets)` and `tar_make()`. This will require `tidycensus` and `sciencebase` credentialing to run, see instructions below.
## `tidycensus` set up
......@@ -36,6 +36,18 @@ census_api_key("YOUR API KEY GOES HERE", install = TRUE)
readRenviron("~/.Renviron")
```
## ScienceBase login
To access controlled ScienceBase items, an additional step must be completed to authenticate a ScienceBase session before the targets pipeline is run.
1. Ensure `.gitignore` includes a line for ".Renviron" to prevent credentials from being committed the the repository by git.
2. Run the entire contents of `00_config.R` either (1) interactively (i.e., line by line) or (2) by running `source("00_config.R")`.
3. You will be prompted to enter the token text by R/Rstudio. A browser window should pop-up directing you to <https://sciencebase.usgs.gov/manager/> to login.
4. Once logged in, copy your API token: click the account drop down button (person shaped icon) and click **Copy API Token**.
5. Paste the API token into the RStudio popup.
Once the above steps are complete, `initialize_and_cache_sb()` will cache your username and token into the .Renviron file. From here, the pipeline should be able to use those cached credentials to re-initialize and refresh ScienceBase sessions in different R sessions for up to 10 hours.
## Building the website locally
Clone the repo. In the directory, run `npm install` to install the required modules. Once the dependencies have been installed, run `npm run dev` to run locally from your browser.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment