Changelog
spdgt.auth 1.1.0.14
Added telemetry realm configuration.
auth_login(realm = "telemetry")now authenticates directly against telemetry-api via OAuth, instead of copying a count-api token that would fail on telemetry-api. Auth dispatch is NULL-safe for realms without OIDC or API key env vars.refresh_auth()now handlesauth_type = "api_key"with a clear error message (“API key was rejected by the server”) instead of the misleading “Unknown authentication type for refresh”.auth_url()is deprecated. Useadd_api()to register API endpoints with their correct URLs instead.Removed legacy counts-hardcoded methods from
APIAuthState(set_api_token(),get_api_token(),forward_token(),set_expiration(),get_expiration(),get_refresh_token(),set_refresh_token(),get_auth_type(),set_auth_type(),set_is_auth(), and backward-compatible URL getters). Use the realm-aware equivalents (get_realm_token(),set_realm_token(), etc.) instead.set_api_key()is deprecated. Set theSPDGT_API_KEYenvironment variable in.Renvironinstead. Thekeyringpackage is no longer a dependency.
spdgt.auth 1.1.0.13
-
auth_login()now checks for API key credentials (environment variable and system keyring) before falling back to OAuth in interactive sessions. Previously, interactive sessions always used OAuth regardless of whether an API key was configured.
spdgt.auth 1.1.0.12
api_post(),api_post_multi(), andapi_post_df()now abort whenadd_project_id = TRUEbut no project is assigned to the authenticated user, instead of silently injectingNULLinto the request body. All three auth flows (authenticate_api_key,authenticate_oidc,authenticate_oauth) now warn at login when the server returns no project assignment.auth_login()now errors with an informative message when no authentication method is available in a non-interactive session, instead of silently returningNULL.auth_logout()andauth_me()now validate therealmargument and error early for unknown realms.parse_json2tibble()now errors when the requested data element is missing from the response, instead of silently returningNULL.parse_json2tibble(null_action=)is deprecated. The parameter was a no-op; tibble columns are neverNULL.parse_url()now validates that the export response contains all required fields before accessing them.type_convert()now warns when the API response has no schema andvalidate = TRUEwas requested, returning data un-validated instead of silently skipping.type_fun()now falls back toidentitywith a warning for unrecognized schema types (e.g., “date”, “datetime”, “decimal”) instead of crashing.auth_url()now warns when called with a non-counts realm, as URL overrides are currently only supported for the counts realm.format_timestamp()now acceptsPOSIXltvalues in addition toPOSIXctand character.Fixed OIDC token refresh to correctly send the request body as JSON and to update the correct realm-specific environment variable instead of always writing to the counts realm’s env var.
Fixed OAuth authentication to abort with a clear error when the
/meverification call fails, instead of silently returning with no credentials set.Removed unused internal helper
null2na().api_body_multi()now errors when passed a zero-row tibble instead of sending an empty request.api_patch()now validates thebodyargument:NULLis rejected with a clear error, and list bodies are accepted in addition to data frames.api_patch_multi()now merges theidvector into the request body for batch PATCH requests, matching the server’s expected format for/multipleendpoints.api_perform()now treats HTTP 202 and 204 as success, fixingapi_delete()which was erroring on standard 204 No Content responses.api_post(),api_post_multi(), andapi_post_df()now abort whenadd_user_id = TRUEbut no user is authenticated, instead of silently injectingNULL.spdgt_select()now requires a tibble (tbl_df) input; plain data frames and other objects are returned unchanged.Moved
lifecycleandR6toImportsand added%||%toimportFrom(rlang)to fix undeclared dependency issues.
spdgt.auth 1.1.0.11
api_filters()andapi_parameters()now silently dropNULLentries from their input lists viacompact_list(), so callers can passlist(a = val, b = NULL)withoutNULLvalues leaking into query parameters.New exported utility functions consolidate helpers previously duplicated across domain packages:
check_enum(),check_required_cols(),compact_list(),format_timestamp(), andparse_multi2tibble().Multi-realm token authentication allows independent per-realm token storage for APIs that have separate databases and token stores. A realm is a named group of APIs sharing one token authority (e.g.,
"counts","telemetry"). All existing behavior defaults to the"counts"realm for full backward compatibility.add_api()gains arealmparameter. Whenrealm = NULL(default), a new realm is created using the API name. When a realm name is provided, the API joins that existing realm and shares its token (e.g.,add_api("sightability", url, realm = "counts")).api_init()now tags each request withspdgt_api_nameso thatapi_perform()can automatically resolve the correct realm and use the appropriate token.api_perform()now performs per-realm token resolution. It checks the request for a realm tag, falls back to the API name mapping, and defaults to"counts". Token refresh is also per-realm.api_perform()now aborts with a structured error on any non-2xx final response, including the HTTP status code, the server’s error message, and field-level validation errors. Previously, some error statuses (e.g., 401 with a valid token, 403) were silently returned to the caller, and validation errors from the$errorsfield were lost.auth_check()gains arealmparameter to validate tokens against the correct realm’s/api/meendpoint.auth_forward_token()gains arealmparameter to forward tokens to a specific realm rather than always using the global state.auth_login()gains arealmparameter. Each realm uses its own OAuth client credentials, API key environment variable, and OIDC token, configured in an internal registry.auth_logout()gains arealmparameter. WhenNULL(default), all realms are logged out. When a specific realm is provided, only that realm is cleared.auth_me()gains arealmparameter to query a specific realm’s/api/meendpoint.set_api_key()gains arealmparameter to store API keys per-realm in the system keyring (e.g.,set_api_key(key, realm = "telemetry")). Keys previously stored under"spdgt"are still found by the legacy fallback.swagger_login()gains arealmparameter to authenticate against a specific realm’s login endpoint.Switched from magrittr pipe (
%>%) to the native pipe operator (|>) throughout the package. The%>%re-export has been removed. Downstream packages that imported%>%from spdgt.auth should import it from magrittr directly or switch to|>.