-
Notifications
You must be signed in to change notification settings - Fork 1
Description
This gargle auth article outlines a list of steps package authors could take to use gargle auth in their packages. I'm not sure how to bake this into generated packages if that's even wise.
Here’s a concrete outline of how one could set up a client package to get its auth functionality from gargle.
Add gargle to your package’s Imports.
Create a file R/YOURPKG_auth.R.
Create an internal gargle::AuthClass object to hold auth state. R/YOURPKG_auth.R is a good place to do this.
Define standard functions for the auth interface between gargle and your package; do this in R/YOURPKG_auth.R. Examples: tidyverse/googledrive/R/drive_auth.R and r-dbi/bigrquery/R/bq_auth.R.
Use gargle’s roxygen helpers to create the docs for your auth functions. This relieves you from writing docs and you inherit standard wording. See previously cited examples for inspiration.
Use the functions YOURPKG_token() and YOURPKG_api_key() (defined in the standard auth interface) to insert a token or API key in your package’s requests._