SudregEx.Token (sudreg_ex v0.1.0)

Copy Markdown View Source

An OAuth2 bearer token together with its computed expiry.

expires_at already folds in the safety margin applied by SudregEx.Auth.fetch_token/1, so expired?/2 is a plain time comparison with no second margin applied.

Summary

Functions

Returns true once now (default DateTime.utc_now/0) has reached or passed the token's expires_at.

Types

t()

@type t() :: %SudregEx.Token{access_token: String.t(), expires_at: DateTime.t()}

Functions

expired?(token, now \\ DateTime.utc_now())

@spec expired?(t(), DateTime.t()) :: boolean()

Returns true once now (default DateTime.utc_now/0) has reached or passed the token's expires_at.