View Source WeChat.TokenChecker (wechat v0.16.0)

Token 检查器

定期(默认为每 5 分钟检查一次)检查 access_token,如果发现失效,则自动刷新

按以下方式配置,将自动给对应的 client 增加检查

注意:此模块不支持企业微信

config :wechat, :check_token_for_clients, [ClientA, ClientB, ClientC]

Summary

Types

@type check_fun() :: (-> WeChat.response())
@type refresh_fun() :: (-> any())

Functions

Link to this function

add(id, check_fun, refresh_fun)

View Source
@spec add(id(), check_fun(), refresh_fun()) :: :ok
@spec add_client(WeChat.client()) :: :ok | nil
Link to this function

add_client(client, refresh_options)

View Source
@spec add_client(WeChat.client(), refresh_options()) :: :ok
Link to this function

add_to_check_clients(client)

View Source
@spec add_to_check_clients(WeChat.client()) :: :ok

Returns a specification to start this module under a supervisor.

See Supervisor.

@spec ids() :: [id()]
Link to this function

maybe_add_client(client, refresh_options)

View Source
@spec maybe_add_client(WeChat.client(), refresh_options()) :: :ok
@spec remove(id()) :: :ok
@spec remove_client(WeChat.client()) :: :ok | nil
Link to this function

remove_from_check_clients(client)

View Source
@spec remove_from_check_clients(WeChat.client()) :: :ok
Link to this function

start_link(settings \\ %{})

View Source
@spec start_link(settings :: map()) :: GenServer.on_start()