-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
483f53e
commit cb85e59
Showing
3 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
_freeze/docs/auth/storing-credentials/execute-results/html.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"hash": "826a7a3b195faf480c719a5e0fce2621", | ||
"result": { | ||
"engine": "knitr", | ||
"markdown": "---\ntitle: Storing credentials\n---\n\n\nAuthentication requires that you provide sensitive data to the R authentication R functions. These are used to verify your identity to the services that you are calling. These sensitive variables **should never be written down in your code**. \n\nThe packages in the R-ArcGIS Bridge rely heavily on **environment variables**. Environment variables are dynamic values that can be set to store sensitive or configuration information, allowing you to manage and control access to crucial data across various tools and applications, including R scripts.\n\n\n## Environment variables \n\nThe package `{arcgisutils}` is responsible for handling authorization for all of the R packages. With it, there are a number of different mechanism for authorizing each requiring a different combination of environment variables. \n\nEnvironment variables are fetched using `Sys.getenv()`. They are key-value pairs. For example, to find the path of R run\n\n\n::: {.cell}\n\n```{.r .cell-code}\nSys.getenv(\"R_HOME\")\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n[1] \"/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources\"\n```\n\n\n:::\n:::\n\n\nOr to set a value use `Sys.setenv()`\n\n\n::: {.cell}\n\n```{.r .cell-code}\nSys.setenv(\"ANSWER_TO_EVERYTHING\" = 42)\nSys.getenv(\"ANSWER_TO_EVERYTHING\")\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n[1] \"42\"\n```\n\n\n:::\n:::\n\n\n\n## Using an `.Renviron` file\n\nEnvironment variables should _**never**_ be included in your code.\nWe recommend using an `.Renviron` file at minimum to store your credentials.\n\nYou can use the `usethis` to edit the file. Ensure it is installed and run the following in your text editor:\n\n:::{.callout-warning}\nIf you modify environment variables you will need to restart your R session for the change to be registered.\n:::\n\n```r\nusethis::edit_r_environ()\n```\n:::{.callout-tip title=\"`.Renviron` scopes\" collapse=\"true\"}\n`.Renviron` files can be created at a user level or a project level. It is recommended to use project level `.Renviron` files when deploying scripts to production. If most of your work is interactive then a user level file is sufficient. \n\n**Project scoped** `.Renviron` files store environment variables that are available for the project _only_. The `.Renviron` is stored at the root folder level.\n\n**User scoped** `.Renviron` files store environment variables in the user's home directory. The environment variables will be available to you in any project you open. However, if you share your project, the environment variables will not be shared with it.\n:::\n\nThis will open your `.Renviron` file for you to edit.\n\n```bash\n# used for OAuth Code & Client\nARCGIS_CLIENT=your-client-id\n# used for OAuth Client flow\nARCGIS_SECRET=your-super-secret-key\n# used for publishing and Username/Password auth\nARCGIS_USER=your-user-name\n# used for API Key auth\nARCGIS_API_KEY=your-developer-api-key\n# specify if not using ArcGIS Online\nARCGIS_HOST=https://your-portal.com/ \n```\n", | ||
"supporting": [], | ||
"filters": [ | ||
"rmarkdown/pagebreak.lua" | ||
], | ||
"includes": {}, | ||
"engineDependencies": {}, | ||
"preserve": {}, | ||
"postProcess": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters