Skip to contents

Who is this package for?

You probably don’t need to use spdgt.auth directly. If you are a wildlife biologist, data analyst, or graduate student working with SpeedGoat data, use one of the domain packages instead:

  • spdgt.sight – sightability and survey data
  • spdgt.core – species, DAU, GMU, and other reference lookups
  • spdgt.depredation – depredation records

These packages handle authentication and API calls behind the scenes. You never need to call auth_login(), build requests, or parse responses yourself.

spdgt.auth is for developers and anyone extending the SpeedGoat ecosystem with new functionality that requires authentication. It provides the shared authentication layer, token management, and request pipeline that all domain packages build on. If you are creating a new spdgt.* package, adding authenticated endpoints to a Shiny app, or contributing to an existing package, this is your starting point.

Installation

Install from the SpeedGoat Nexus repository:

install.packages(
  "spdgt.auth",
  repos = c(SPDGT = "https://nexus.spdgt.com/repository/public-group/")
)

To make the SpeedGoat Nexus repository always available, add this to your .Rprofile:

options(
  repos = c(
    SPDGT = "https://nexus.spdgt.com/repository/public-group/",
    CRAN = "https://cloud.r-project.org"
  )
)

Note: The source repository is private. Install the package from Nexus as shown above.

Authentication

Authentication happens automatically on first API call. In interactive sessions an OAuth browser flow opens; in non-interactive environments the package checks for OIDC tokens (ShinyProxy) or API keys.

library(spdgt.sight)

# Authentication fires automatically on first API call
resp <- sight_read_surveys()

For non-interactive use, set the SPDGT_API_KEY environment variable in your .Renviron file.

Multi-realm support

APIs with separate databases use independent token stores called realms. By default everything uses the "counts" realm. APIs that share a token join an existing realm:

# Creates the "counts" realm
add_api("counts", "https://counts.spdgt.com/api")

# Joins the counts realm (shares its token)
add_api("sightability", "https://sight.spdgt.com/api", realm = "counts")

# Creates a separate "telemetry" realm
add_api("telemetry", "https://telemetry.spdgt.com/api")

Request pipeline

Build and execute requests by chaining modifiers:

api_get(
  "counts", "species",
  filters = list(name = "~Elk"),
  includes = c("projects"),
  pages = list(size = 50)
) |>
  parse_json2tibble()

Documentation

Full documentation is available at the developer portal, including:

  • Authentication – auth flows, token forwarding, and multi-realm setup
  • Requests – building requests, filtering, pagination, and response parsing
  • Response patterns – parsing strategies and type conversion
  • Internals – realm architecture and token resolution

All SpeedGoat packages are listed at the developer portal.