Skip to content

Commit 8739bd4

Browse files
harjas27Harness
authored andcommitted
[fix]:[IDP-6019]: Incorrect token being passed in execute workflow (#155)
* [fix]:[IDP-6019]: Incorrect token being passed in execute workflow
1 parent ee33e3f commit 8739bd4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

client/idp.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"log/slog"
7+
"strings"
78

89
"github.com/harness/harness-mcp/client/dto"
910
)
@@ -192,11 +193,16 @@ func (i *IDPService) ExecuteWorkflow(ctx context.Context, scope dto.Scope, ident
192193
params := make(map[string]string)
193194
addScope(scope, params)
194195

195-
_, token, err := i.Client.AuthProvider.GetHeader(ctx)
196+
_, authHeaderVal, err := i.Client.AuthProvider.GetHeader(ctx)
196197
if err != nil {
197198
slog.Error("Failed to get auth header", "error", err)
198199
return nil, err
199200
}
201+
token := authHeaderVal
202+
parts := strings.Split(authHeaderVal, " ")
203+
if len(parts) == 2 {
204+
token = parts[1]
205+
}
200206
inputSet["token"] = token
201207
body := new(dto.ExecuteWorkflowRequest)
202208
body.Identifier = identifier

0 commit comments

Comments
 (0)