# `GcpCompute.TokenProvider.Static`
[🔗](https://github.com/nyo16/gcp_compute/blob/v0.3.0/lib/gcp_compute/token_provider/static.ex#L1)

`GcpCompute.TokenProvider` that returns a fixed token.

Useful for tests, the Compute emulator, or environments where a token is
injected out-of-band. The `arg` may be:

  * a binary — used directly as the bearer token;
  * a `%{token: ...}` map — returned as-is;
  * a zero-arity function — invoked to produce `{:ok, token}` / `{:error, _}`.

    GcpCompute.Config.local(project: "my-project", token: "ya29.fake")
    # => token_provider: {GcpCompute.TokenProvider.Static, "ya29.fake"}

Anything else returns `{:error, %GcpCompute.Error{reason: :invalid_token_provider_arg}}`.
The error `:message` names only the *type* of the rejected `arg`, never its
value — a mis-shaped arg is usually a credential (`%{"access_token" => ...}`,
`{:bearer, ...}`), and `:message` ends up in logs and crash reports. The raw
value is kept in `:body`, which `GcpCompute.Error`'s `Inspect` redacts.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
