Skip to contents

Add an API endpoint to authentication state

Usage

add_api(name, url, realm = NULL)

Arguments

name

String. Name of the API to add

url

String. URL of the API endpoint

realm

String. Optional realm name to join. If NULL (default), a new realm is created with the API name. If provided, the API joins an existing realm and shares its token.

Value

Invisibly returns TRUE if API was added or already exists with same URL, FALSE if API exists with different URL

See also

APIAuthState for the underlying state object, auth_url() to override a realm's base URL

Examples

if (FALSE) { # \dontrun{
# In package's .onLoad — creates the "counts" realm
add_api("counts", "https://counts.spdgt.com/api")

# Satellite API joins the counts realm
add_api("sightability", "https://sightability.spdgt.com/api",
  realm = "counts")
} # }