Behaviours: gen_server.
Caches a Google OAuth 2.0 access token for the FCM HTTP v1 API.
Signs an RS256 JWT with the service account's private key,
exchanges it at https://oauth2.googleapis.com/token, and serves
the cached access token until it is within 60 s of expiry (lazy
refresh: an idle service makes no network calls).
invalidate/0 drops the cache, used when FCM answers 401.
get_token/0 then
returns {error, not_configured} and FCM deliveries are reported
as not_configured instead of crashing the node.
| configured/0 | True when a service account was loaded. |
| get_token/0 | A valid access token, minting one when needed. |
| handle_call/3 | |
| handle_cast/2 | |
| handle_info/2 | |
| init/1 | |
| invalidate/0 | Forget the cached access token so the next call mints a new one. |
| project_id/0 | The Firebase project id (from the service account, or FCM_PROJECT_ID). |
| start_link/0 |
configured() -> boolean()
True when a service account was loaded.
get_token() -> {ok, binary()} | {error, term()}
A valid access token, minting one when needed.
handle_call(Req, From, S) -> any()
handle_cast(Msg, S) -> any()
handle_info(Info, S) -> any()
init(X1) -> any()
invalidate() -> ok
Forget the cached access token so the next call mints a new one.
project_id() -> binary() | undefined
The Firebase project id (from the service account, or FCM_PROJECT_ID).
start_link() -> gen_server:start_ret()
Generated by EDoc