| api_auth_guard | R Documentation |
This function adds an auth guard to your API. Notably, this does
not turn on auth for any of your handlers but makes it available
for reference in an auth flow. To use it, reference it in the
auth_flow argument of functions supporting it. Guards are
defined using the various guard_*() constructors in the fireproof package.
Refer to these for further documentation
api_auth_guard(api, guard, name = NULL)
api |
A plumber2 api object to add the authenticator to |
guard |
A Guard subclass object defining an authentication scheme |
name |
The name to use for referencing the guard in an authentication flow |
This functions return the api object allowing for easy chaining
with the pipe
To add a guard to your api defined in an annotated file use the
@authGuard tag:
#* @authGuard BasicAuth fireproof::guard_basic(...)
The tag parameter (BasicAuth) provides the name for the guard
guard <- fireproof::guard_key(
key_name = "plumber2-key",
validate = "MY_VERY_SECRET_KEY"
)
api() |>
api_datastore(storr::driver_environment()) |>
api_auth_guard(guard, "cookie_key")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.