Skip to content

Instantly share code, notes, and snippets.

@deboorn
Created May 31, 2017 21:19
Show Gist options
  • Save deboorn/2e4d00f02a47434f470774a621a16dc8 to your computer and use it in GitHub Desktop.
Save deboorn/2e4d00f02a47434f470774a621a16dc8 to your computer and use it in GitHub Desktop.
Decode JSON Web Token with Public Key
<?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