Skip to content

[Callback Authentication] Signatures do not match #13

@revroad-dev

Description

@revroad-dev

When constructing ShippingEasy_Authenticator(), unset($params["api_signature"]) causes $params to be empty. Consequently when constructing ShippingEasy_Signature(), the plaintext() method excludes $params.

public function plaintext()
  {
    $parts = array($this->getHttpMethod());
    $parts[] = $this->getPath();

    if (!empty($this->getParams()))
      $parts[] = http_build_query($this->getParams());

    if ($this->getJsonBody() != "null")
      $parts[] = $this->getJsonBody();

    return implode("&", $parts);
  }

Result: Signatures do not match and authentication fails.

In order to achieve authentication I had to append an extra '&' to the end of $path in order to get the signature supplied by the server to match.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions