MCPcopy
hub / github.com/larksuite/cli / NewNeedUserAuthorizationError

Function NewNeedUserAuthorizationError

internal/auth/errors.go:43–49  ·  view source on GitHub ↗

NewNeedUserAuthorizationError builds the typed *errs.AuthenticationError returned when no valid UAT exists for userOpenID. The Message keeps the need_user_authorization marker, the Hint converges on the same auth-login recovery vocabulary as the token-missing surface in internal/client, and the lega

(userOpenID string)

Source from the content-addressed store, hash-verified

41// legacy *NeedAuthorizationError sentinel is preserved in the Cause chain for
42// errors.As / errors.Is traversal.
43func NewNeedUserAuthorizationError(userOpenID string) *errs.AuthenticationError {
44 return errs.NewAuthenticationError(errs.SubtypeTokenMissing,
45 "%s (user: %s)", needUserAuthorizationMarker, userOpenID).
46 WithUserOpenID(userOpenID).
47 WithHint("run: lark-cli auth login to re-authorize").
48 WithCause(&NeedAuthorizationError{UserOpenId: userOpenID})
49}
50
51// IsNeedUserAuthorizationError reports whether err represents a missing-UAT
52// failure. It matches the legacy *NeedAuthorizationError sentinel, which is

Callers 2

GetValidAccessTokenFunction · 0.85

Calls 4

NewAuthenticationErrorFunction · 0.92
WithUserOpenIDMethod · 0.80
WithCauseMethod · 0.45
WithHintMethod · 0.45

Tested by 1