Basic Auth throwing "cannot unmarshal string"

Enabling basic auth in pinsvcapi is throwing the following:

2024-05-14T13:30:51.399Z        INFO    service ipfs-cluster-service/daemon.go:49       Initializing. For verbose output run with "-l debug". Please wait...
2024-05-14T13:30:51.400Z        ERROR   pinsvcapi       common/config.go:214    pinsvcapi: error unmarshaling config
2024-05-14T13:30:51.400Z        ERROR   config  config/config.go:454    json: cannot unmarshal string into Go struct field jsonConfig.basic_auth_credentials of type map[string]string
error loading configurations: json: cannot unmarshal string into Go struct field jsonConfig.basic_auth_credentials of type map[string]string

Here is the pinsvcapi config:

"pinsvcapi": {
      "http_listen_multiaddress": "/ip4/127.0.0.1/tcp/9097",
      "read_timeout": "0s",
      "read_header_timeout": "5s",
      "write_timeout": "0s",
      "idle_timeout": "2m0s",
      "max_header_bytes": 4096,
      "basic_auth_credentials": "test:test",
      "http_log_file": "",
      "headers": {},
      "cors_allowed_origins": [
        "*"
      ],
      "cors_allowed_methods": [
        "GET"
      ],
      "cors_allowed_headers": [],
      "cors_exposed_headers": [
        "Content-Type",
        "X-Stream-Output",
        "X-Chunked-Output",
        "X-Content-Length"
      ],
      "cors_allow_credentials": true,
      "cors_max_age": "0s"
    },

Do I have the format wrong for setting user and password? I was unable to find any examples of how this is set.

Its should be an object like { "test": " test" }

1 Like