Skip to content

Commit e2b9be6

Browse files
replace global client with new one after cli.Connect (#1390)
1 parent 4af5d4a commit e2b9be6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/pkg/login/login.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func NonInteractiveGitHubLogin(ctx context.Context, client client.FabricClient,
111111
return cluster.SaveAccessToken(fabric, resp.AccessToken)
112112
}
113113

114-
func InteractiveRequireLoginAndToS(ctx context.Context, fabric client.FabricClient, addr string) error {
114+
func InteractiveRequireLoginAndToS(ctx context.Context, fabric *client.GrpcClient, addr string) error {
115115
var err error
116116
if err = fabric.CheckLoginAndToS(ctx); err != nil {
117117
// Login interactively now; only do this for authorization-related errors
@@ -126,8 +126,10 @@ func InteractiveRequireLoginAndToS(ctx context.Context, fabric client.FabricClie
126126
}
127127

128128
// Reconnect with the new token
129-
if fabric, err = cli.Connect(ctx, addr); err != nil {
129+
if newFabric, err := cli.Connect(ctx, addr); err != nil {
130130
return err
131+
} else {
132+
*fabric = *newFabric
131133
}
132134

133135
if err = fabric.CheckLoginAndToS(ctx); err == nil { // recheck (new token = new user)

0 commit comments

Comments
 (0)