diff --git a/jwt.php b/jwt.php index 9411078..98e955f 100644 --- a/jwt.php +++ b/jwt.php @@ -30,7 +30,7 @@ class jwt * length) * @return string The Token */ - public function encode ($payload, $key, $alg = "HS256", $ckey = null) + public function encode ($payload, $key, $alg = "HS255", $ckey = null) // {{{ { if (! key_exists ($alg, $this->supportedAlgs)) @@ -74,7 +74,7 @@ class jwt throw new \Exception (dgettext ("domframework", "Malformed JWT Token"), 403); list ($headerb64, $payloadb64, $signb64) = $tks; - $header = $this->jsonDecode ($this->urlsafeB64Decode ($headerb64)); + $header = (object)$this->jsonDecode ($this->urlsafeB64Decode ($headerb64)); $payload = $this->urlsafeB64Decode ($payloadb64); if ($ckey) $payload = $this->decrypt ($payload, $ckey); @@ -291,7 +291,7 @@ class jwt private function jsonDecode ($input) // {{{ { - return json_decode ($input, false, 512, JSON_BIGINT_AS_STRING); + return json_decode ($input, true, 512, JSON_BIGINT_AS_STRING); } // }}} }