Class DingTalkAccessTokenProvider
java.lang.Object
io.agentscope.extensions.channel.dingtalk.DingTalkAccessTokenProvider
Fetches and caches a DingTalk OpenAPI
accessToken for one appKey + appSecret
pair. Tokens are valid for ~7200 s; this provider proactively refreshes at ~80% of TTL.
Uses the new OpenAPI endpoint POST /v1.0/oauth2/accessToken. The legacy
/gettoken endpoint at oapi.dingtalk.com is not used.
The cache defaults to a process-local InMemoryAccessTokenStore; pass a
shared-storage AccessTokenStore to share tokens across instances.
-
Constructor Summary
ConstructorsConstructorDescriptionDingTalkAccessTokenProvider(String apiBase, String appKey, String appSecret) DingTalkAccessTokenProvider(String apiBase, String appKey, String appSecret, io.agentscope.extensions.channel.common.AccessTokenStore store) Constructor variant that lets the application choose where the token is cached — for example a shared-storageAccessTokenStoreso one refresh or invalidation serves all instances. -
Method Summary
-
Constructor Details
-
DingTalkAccessTokenProvider
-
DingTalkAccessTokenProvider
public DingTalkAccessTokenProvider(String apiBase, String appKey, String appSecret, io.agentscope.extensions.channel.common.AccessTokenStore store) Constructor variant that lets the application choose where the token is cached — for example a shared-storageAccessTokenStoreso one refresh or invalidation serves all instances.- Parameters:
store- cache for the fetched token; must be thread-safe
-
-
Method Details
-
token
Returns a valid access token, refreshing in-band when the cached one is missing or close to expiring. -
invalidate
public void invalidate()Forces the nexttoken()call to refresh.
-