@@ -68,7 +68,13 @@ run --device-code in a later step after the user confirms authorization.`,
6868
6969 cmd .Flags ().StringVar (& opts .Scope , "scope" , "" , "scopes to request (space- or comma-separated). Combines additively with --domain/--recommend" )
7070 cmd .Flags ().BoolVar (& opts .Recommend , "recommend" , false , "request only recommended (auto-approve) scopes" )
71- available := sortedKnownDomains ()
71+ var helpBrand core.LarkBrand
72+ if f != nil && f .Config != nil {
73+ if cfg , err := f .Config (); err == nil && cfg != nil {
74+ helpBrand = cfg .Brand
75+ }
76+ }
77+ available := sortedKnownDomains (helpBrand )
7278 cmd .Flags ().StringSliceVar (& opts .Domains , "domain" , nil ,
7379 fmt .Sprintf ("domain (repeatable or comma-separated, e.g. --domain calendar,task)\n available: %s, all" , strings .Join (available , ", " )))
7480 cmd .Flags ().StringSliceVar (& opts .Exclude , "exclude" , nil ,
@@ -139,14 +145,14 @@ func authLoginRun(opts *LoginOptions) error {
139145 // Expand --domain all to all available domains (from_meta projects + shortcut services)
140146 for _ , d := range selectedDomains {
141147 if strings .EqualFold (d , "all" ) {
142- selectedDomains = sortedKnownDomains ()
148+ selectedDomains = sortedKnownDomains (config . Brand )
143149 break
144150 }
145151 }
146152
147153 // Validate domain names and suggest corrections for unknown ones
148154 if len (selectedDomains ) > 0 {
149- knownDomains := allKnownDomains ()
155+ knownDomains := allKnownDomains (config . Brand )
150156 for _ , d := range selectedDomains {
151157 if ! knownDomains [d ] {
152158 if suggestion := suggestDomain (d , knownDomains ); suggestion != "" {
@@ -170,7 +176,7 @@ func authLoginRun(opts *LoginOptions) error {
170176
171177 if ! hasAnyOption {
172178 if ! opts .JSON && f .IOStreams .IsTerminal {
173- result , err := runInteractiveLogin (f .IOStreams , lang , msg )
179+ result , err := runInteractiveLogin (f .IOStreams , lang , msg , config . Brand )
174180 if err != nil {
175181 return err
176182 }
@@ -208,10 +214,10 @@ func authLoginRun(opts *LoginOptions) error {
208214 if len (selectedDomains ) > 0 || opts .Recommend {
209215 var candidateScopes []string
210216 if len (selectedDomains ) > 0 {
211- candidateScopes = collectScopesForDomains (selectedDomains , "user" )
217+ candidateScopes = collectScopesForDomains (selectedDomains , "user" , config . Brand )
212218 } else {
213219 // --recommend without --domain: all domains
214- candidateScopes = collectScopesForDomains (sortedKnownDomains (), "user" )
220+ candidateScopes = collectScopesForDomains (sortedKnownDomains (config . Brand ), "user" , config . Brand )
215221 }
216222
217223 // Filter to auto-approve scopes if --recommend or interactive "common"
@@ -490,7 +496,7 @@ func findProfileByName(multi *core.MultiAppConfig, profileName string) *core.App
490496// shortcut scopes for the given domain names.
491497// Domains with auth_domain children are automatically expanded to include
492498// their children's scopes.
493- func collectScopesForDomains (domains []string , identity string ) []string {
499+ func collectScopesForDomains (domains []string , identity string , brand core. LarkBrand ) []string {
494500 scopeSet := make (map [string ]bool )
495501
496502 // 1. API scopes from from_meta projects
@@ -509,6 +515,9 @@ func collectScopesForDomains(domains []string, identity string) []string {
509515
510516 // 3. Shortcut scopes matching by Service (only include shortcuts supporting the identity)
511517 for _ , sc := range shortcuts .AllShortcuts () {
518+ if ! shortcuts .IsShortcutServiceAvailable (sc .Service , brand ) {
519+ continue
520+ }
512521 if domainSet [sc .Service ] && shortcutSupportsIdentity (sc , identity ) {
513522 for _ , s := range sc .DeclaredScopesForIdentity (identity ) {
514523 scopeSet [s ] = true
@@ -528,14 +537,17 @@ func collectScopesForDomains(domains []string, identity string) []string {
528537// allKnownDomains returns all valid auth domain names (from_meta projects +
529538// shortcut services), excluding domains that have auth_domain set (they are
530539// folded into their parent domain).
531- func allKnownDomains () map [string ]bool {
540+ func allKnownDomains (brand core. LarkBrand ) map [string ]bool {
532541 domains := make (map [string ]bool )
533542 for _ , p := range registry .ListFromMetaProjects () {
534543 if ! registry .HasAuthDomain (p ) {
535544 domains [p ] = true
536545 }
537546 }
538547 for _ , sc := range shortcuts .AllShortcuts () {
548+ if ! shortcuts .IsShortcutServiceAvailable (sc .Service , brand ) {
549+ continue
550+ }
539551 if ! registry .HasAuthDomain (sc .Service ) {
540552 domains [sc .Service ] = true
541553 }
@@ -544,8 +556,8 @@ func allKnownDomains() map[string]bool {
544556}
545557
546558// sortedKnownDomains returns all valid domain names sorted alphabetically.
547- func sortedKnownDomains () []string {
548- m := allKnownDomains ()
559+ func sortedKnownDomains (brand core. LarkBrand ) []string {
560+ m := allKnownDomains (brand )
549561 domains := make ([]string , 0 , len (m ))
550562 for d := range m {
551563 domains = append (domains , d )
0 commit comments