The auth0api
library is a minimalistic Auth0 management API client in R.
Using the 'devtools' package:
> install.packages("devtools")
> devtools::install_github("Appsilon/auth0-api")
This package is still in the development phase and it has not been published on CRAN yet.
All endpoints are described in the Auth0 Managment API documentation.
To generate the API token see auth0 tokens documentattion or auth0api::generate_token
function documentation.
To use the API you need to set a domain and API token.
The token by default is read from an environment variable or can be passed as a param to the auth0
function.
# Set domain
set_domain("https://auth0-org-domain.aut0.com")
Sys.setenv(AUTH0_DOMAIN="organization-domain")
# Set the token
set_token("api-key")
Sys.setenv(AUTH0_API_KEY="api-key")
The API is minimalistic and you can easily access all endpoints in Auth0 Managment API.
auth0(endpoint, ..., .domain = NULL, .auth_key = api_token())
Use any endpoint from Auth0 API e.g. GET /api/v2/roles/{id}
. The strings are interpolated using the glue library and as a paramaters of function use variable in brackets. See glue for more information.
auth0("GET /api/v2/users/{id}", id = "auth0|userid")
The package contains predefined function allows to access the Auth0 API.
get_user("google-oauth2|1231231")
More help can be found in the package docs. For more information please contact [email protected]
Package development roadmap
- Add more tests 🚀
- Improve error message e.g. returns
Unauthorized
- Add CI check to the repository
- Add verbose and debug options
- Improve documentation
- Create more predefined functions
- ...