FeishuAccessTokenProvider
public final class FeishuAccessTokenProvider
io/agentscope/extensions/channel/feishu/FeishuAccessTokenProvider.java:40–119Feishu 访问令牌提供者,把智能体接入外部消息渠道与企业平台。位于 io.agentscope.extensions.channel.feishu 包。核心成员包括 token、invalidate、FeishuAccessTokenProvider。
Fetches and caches a Feishu tenant_access_token for one app_id + app_secret
pair. Tokens are valid for ~7200 s; this provider proactively refreshes at ~80% of TTL.
The cache defaults to a process-local InMemoryAccessTokenStore; pass a
shared-storage AccessTokenStore to share tokens across instances.
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public FeishuAccessTokenProvider(String apiBase, String appId, String appSecret) | 初始化 `FeishuAccessTokenProvider` 实例。 Creates a new instance. |
public FeishuAccessTokenProvider(String apiBase, String appId, String appSecret, AccessTokenStore store) | 初始化 `FeishuAccessTokenProvider` 实例。 Constructor variant that lets the application choose where the token is cached — for
example a shared-storage `AccessTokenStore` so one refresh or invalidation serves
all instances. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Mono<String> token() | 返回令牌。 Returns a valid tenant_access_token, refreshing in-band when missing or near-expiry. |
public void invalidate() | 执行 `invalidate` 方法。 Forces the next `#token()` call to refresh. |
构造器详情Constructor Detail
FeishuAccessTokenProvider
public FeishuAccessTokenProvider(String apiBase, String appId, String appSecret)
初始化 FeishuAccessTokenProvider 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
apiBase | String | API 基类(类型 `String`)。The api base. |
appId | String | 应用标识(类型 `String`)。The app id. |
appSecret | String | 应用密钥(类型 `String`)。The app secret. |
io/agentscope/extensions/channel/feishu/FeishuAccessTokenProvider.java:49–51FeishuAccessTokenProvider
public FeishuAccessTokenProvider(String apiBase, String appId, String appSecret, AccessTokenStore store)
初始化 FeishuAccessTokenProvider 实例。
Constructor variant that lets the application choose where the token is cached — for example a shared-storage AccessTokenStore so one refresh or invalidation serves all instances.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
apiBase | String | API 基类(类型 `String`)。The api base. |
appId | String | 应用标识(类型 `String`)。The app id. |
appSecret | String | 应用密钥(类型 `String`)。The app secret. |
store | AccessTokenStore | 存储实例(类型 `AccessTokenStore`)。cache for the fetched token; must be thread-safe |
io/agentscope/extensions/channel/feishu/FeishuAccessTokenProvider.java:60–66方法详情Method Detail
token
public Mono<String> token()
返回令牌。
Returns a valid tenant_access_token, refreshing in-band when missing or near-expiry.
Mono<String>io/agentscope/extensions/channel/feishu/FeishuAccessTokenProvider.java:69–75invalidate
public void invalidate()
执行 invalidate 方法。
Forces the next #token() call to refresh.
io/agentscope/extensions/channel/feishu/FeishuAccessTokenProvider.java:116–118