Created
May 31, 2017 21:19
-
-
Save deboorn/2e4d00f02a47434f470774a621a16dc8 to your computer and use it in GitHub Desktop.
Decode JSON Web Token with Public Key
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Example of decoding JWT Web Token with public key | |
// Package: https://github.com/firebase/php-jwt | |
require_once 'vendor/autoload.php'; | |
use \Firebase\JWT\JWT; | |
$key = "-----BEGIN PUBLIC KEY----- YOUR PUBLIC KEY HERE -----END PUBLIC KEY-----"; | |
$jwt = $_GET['token']; | |
$decoded = JWT::decode($jwt, $key, array('RS256')); | |
print_r($decoded); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment