From 4d7939e9e5ecad791311465b256d27ad538b86e1 Mon Sep 17 00:00:00 2001 From: Jonathan Daggerhart Date: Sun, 4 Nov 2018 07:50:40 -0500 Subject: [PATCH] Bug with some special char in the firstname or lastname Add str_replace because token is encoded in base64 URL (and not just base64). Solves the problem with some special char Re: #101 --- includes/openid-connect-generic-client.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/includes/openid-connect-generic-client.php b/includes/openid-connect-generic-client.php index c408291..7b8b11c 100644 --- a/includes/openid-connect-generic-client.php +++ b/includes/openid-connect-generic-client.php @@ -316,7 +316,16 @@ class OpenID_Connect_Generic_Client { } // Extract the id_token's claims from the token - $id_token_claim = json_decode( base64_decode( $tmp[1] ), TRUE ); + $id_token_claim = json_decode( + base64_decode( + str_replace( // because token is encoded in base64 URL (and not just base64) + array('-', '_'), + array('+', '/'), + $tmp[1] + ) + ) + , TRUE + ); return $id_token_claim; }