View Source WeChat.TokenChecker (wechat v0.16.0)
Token 检查器
定期(默认为每 5 分钟检查一次)检查 access_token,如果发现失效,则自动刷新
按以下方式配置,将自动给对应的 client 增加检查
注意:此模块不支持企业微信
config :wechat, :check_token_for_clients, [ClientA, ClientB, ClientC]
Summary
Functions
Returns a specification to start this module under a supervisor.
Types
@type check_fun() :: (-> WeChat.response())
@type refresh_fun() :: (-> any())
Functions
@spec add(id(), check_fun(), refresh_fun()) :: :ok
@spec add_client(WeChat.client()) :: :ok | nil
@spec add_client(WeChat.client(), refresh_options()) :: :ok
@spec add_to_check_clients(WeChat.client()) :: :ok
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec ids() :: [id()]
@spec maybe_add_client(WeChat.client(), refresh_options()) :: :ok
@spec remove(id()) :: :ok
@spec remove_client(WeChat.client()) :: :ok | nil
@spec remove_from_check_clients(WeChat.client()) :: :ok
@spec start_link(settings :: map()) :: GenServer.on_start()