Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: clear token cache on patch (#3408)

p0ny99af4319e356
diff --git a/plugin/app/feishu/feishu.go b/plugin/app/feishu/feishu.go
index 83c6462456..07f27feb7e 100644
--- a/plugin/app/feishu/feishu.go
+++ b/plugin/app/feishu/feishu.go
@@ -42,6 +42,11 @@ func NewProvider() *Provider {
return &p
}
+// ClearTokenCache clears cached token.
+func (p *Provider) ClearTokenCache() {
+ p.Token.Store("")
+}
+
// TokenCtx is the token context to access feishu APIs.
type TokenCtx struct {
AppID string
diff --git a/server/setting.go b/server/setting.go
index 2d6860f23c..acff6731eb 100644
--- a/server/setting.go
+++ b/server/setting.go
@@ -72,6 +72,8 @@ func (s *Server) registerSettingRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusBadRequest, api.FeatureIMApproval.AccessErrorMessage())
}
p := s.ApplicationRunner.p
+ // clear token cache so that we won't use the previous token.
+ p.ClearTokenCache()
approvalCode, err := p.CreateApprovalDefinition(ctx, feishu.TokenCtx{
AppID: value.AppID,
AppSecret: value.AppSecret,