MCPcopy Create free account
hub / github.com/bytebase/bytebase / Validate

Function Validate

backend/plugin/webhook/feishu/app.go:76–86  ·  view source on GitHub ↗
(ctx context.Context, id, secret, email string)

Source from the content-addressed store, hash-verified

74}
75
76func Validate(ctx context.Context, id, secret, email string) error {
77 p := newProvider(id, secret)
78 if err := p.refreshToken(ctx); err != nil {
79 return errors.Wrapf(err, "failed to refresh token")
80 }
81 _, err := p.getIDByEmail(ctx, []string{email})
82 if err != nil {
83 return errors.Wrapf(err, "failed to get id for user %s", email)
84 }
85 return nil
86}
87
88func getToken(ctx context.Context, c *http.Client, id, secret string) (*tokenValue, error) {
89 const getTenantAccessTokenReq = `{"app_id": "%s","app_secret": "%s"}`

Callers 1

UpdateSettingMethod · 0.92

Calls 3

newProviderFunction · 0.70
refreshTokenMethod · 0.45
getIDByEmailMethod · 0.45

Tested by

no test coverage detected