GSS. Auth
(elixir_google_spreadsheets v1.0.2)
Copy Markdown
Authentication for the Google Sheets API.
A bearer token is resolved at request time from the first configured source, in this order of precedence (first configured wins):
:token_generator—{module, function, args}returning{:ok, token}; an escape hatch, also used to stub auth in tests.:goth— the name of aGothinstance already running in the host application. GSS starts no Goth child of its own.:source— anyGothsource (e.g.:default,{:metadata, []},{:service_account, credentials, opts}). GSS starts its own Goth child.:json— legacy raw service-account JSON string, turned into a{:service_account, ...}source. GSS starts its own Goth child.
"Configured" means Application.get_env/2 returns a non-nil value; an
explicitly-set nil counts as unset (the escape hatch for *.local.exs
overrides). When nothing is configured, token!/0 raises
GSS.MissingAuthConfig.
Summary
Functions
Whether any authentication source is configured.
Return the bearer token string for the Google Sheets API.
Types
Functions
@spec configured?() :: boolean()
Whether any authentication source is configured.
Child spec for GSS's own Goth instance, or nil when GSS must not start
one (host app supplies its own Goth, uses a token generator, or nothing is
configured).
@spec token!() :: String.t()
Return the bearer token string for the Google Sheets API.
Raises GSS.MissingAuthConfig when no authentication is configured.