HTTP Call to a Shelly 1 PM Plus with authorization ends in Error message "Invalid argument 'headers': length should be less than 128!"

  • Hi,

    i have some issues when calling a Shelly 1 PM Plus from another shelly via HTTP Request:

    i want to switch the shelly off :

                let url = '{"method": "GET", ' +
                  ' "url":"http://admin:asdfasdfasdf@10.2.103.215/rpc/Switch.Set?id=0&on=false", ' +
                  ' "headers": {"Authorization": "Digest username=\\"admin\\", response=\\"6df8a5a2328b4a43eb5abedf0fasdfasdf47f876c85ecf1asdfasdfe9eb5ac33\\", qop=auth, algorithm=SHA-256"}' +
                  '}';
                  if(DEBUG_LIGHT_TOGGLE)
                    print("url = " + url);
                  Shelly.call( 'HTTP.Request',
                  url,
                  function callback(result, error_code, error_message, userdata)
    {
                      if(DEBUG_LIGHT_TOGGLE)
    {
                        print('ANFANG Regal callback off');
                        print(JSON.stringify(result));
                        print(error_code);
                        print(error_message);
                        print(userdata);
                        print(result.body);
    }

                      if(result.body !== undefined)
    {
                        let a = JSON.parse(result.body);
                        if(DEBUG_LIGHT_TOGGLE)
    {
                          print('r.isOn=' + JSON.stringify(a.ison));
                          print('r.brightness=' + JSON.stringify(a.brightness));
    }
    }
                      else
                        print('ERROR: result.body = UNDEFINED');
                      print('ENDE Regal callback turn off');
    },
                  null);

    but in the Logs i can see an error:

    url = {"method": "GET", "url":"http://admin:asdfasdfasdf@10.2.103.215/rpc/Switch.Set?id=0&on=false", "headers": {"Authorization": "Digest username=\"admin\", response=\"6df8aasdfasdfdf0f537eecf7b47f876c85ecf1asdfasdfasdf9eb5ac33\", qop=auth, algorithm=SHA-256"}}

    ANFANG Regal callback off

    null

    -103

    Invalid argument 'headers': length should be less than 128!

    null

    at script_1.js:465

    at api_rpc.js:8

    RPC cb error: type error

    the Shelly 1 PM Plus is configured with authorization via "Device -> Authorization -> auth password".

    if i remove the authorization i do not need to supply the authorization header, so i do not exceed this limit.

    is there a better way to do auth and change the state of the relais?

    thanks for every hint!

    best regards

    Alex