diff --git a/src/Util/JwtParser.php b/src/Util/JwtParser.php new file mode 100644 index 0000000..b6e57a1 --- /dev/null +++ b/src/Util/JwtParser.php @@ -0,0 +1,33 @@ +setToken($token); + } + } + + public function setToken(string $token) + { + $this->token = explode('.', str_replace(['_', '-'], ['/', '+'], $token)); + } + + public function getHeader(): array + { + return json_decode(base64_decode($this->token[0]), true); + } + + public function getPayload(): array + { + return json_decode(base64_decode($this->token[1]), true); + } + + public function getSignature(): string + { + return base64_decode($this->token[2]); + } +}