Adapts a TokenManager to the Aliyun SDK credential interface for seamless auth.
// Source: https://github.com/agentscope-ai/AgentTeams | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works // Provided via justclaw.it.com; keep this notice with the code. package credprovider import ( "context" credential "github.com/aliyun/credentials-go/credentials" ) // NewAliyunCredential adapts a TokenManager into the // github.com/aliyun/credentials-go Credential interface, which is what // Alibaba Cloud SDK clients (APIG, OSS, STS, ...) consume. // // Each call the SDK makes to GetCredential() triggers TokenManager.Token, // which transparently refreshes the STS triple when it is about to // expire. SDK clients therefore see a credential that never goes stale // so long as the sidecar stays reachable. // // Note: the SDK may call the G ... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key