Skip to content

Commit 28bb29d

Browse files
committed
add basic auth functionality
1 parent 948b9f8 commit 28bb29d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cmdgen/cmdgen.wasm.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ func ConstructCommand(parsedInput *gabs.Container, o *lama2cmd.Opts) ([]string,
9999
}
100100
case "basic-auth":
101101
if username, ok := authValue["username"].(string); ok {
102-
fmt.Println("DBGYYZ: username:", username)
103102
if password, ok := authValue["password"].(string); ok {
104-
fmt.Println("DBGYYZ: password:", password)
105-
selectedAuthHeader = "Authorization: Basic " + username + ":" + password
103+
credentials := username + ":" + password
104+
encoded := js.Global().Get("btoa").Invoke(credentials).String()
105+
selectedAuthHeader = "Authorization: Basic " + encoded
106106
}
107107
}
108108
}

0 commit comments

Comments
 (0)