140,8 → 140,24 |
|
private function decoderToken($token) { |
$token_parts = explode('.', $token); |
return json_decode(base64_decode($token_parts[1]), true); |
return json_decode($this->urlsafeB64Decode($token_parts[1]), true); |
} |
|
/** |
* Decode a string with URL-safe Base64. |
* copiƩ depuis firebase/jwt |
* |
* @param string $input A Base64 encoded string |
* @return string A decoded string |
*/ |
protected function urlsafeB64Decode($input) { |
$remainder = strlen($input) % 4; |
if ($remainder) { |
$padlen = 4 - $remainder; |
$input .= str_repeat('=', $padlen); |
} |
return base64_decode(strtr($input, '-_', '+/')); |
} |
|
private function obtenirLoginParToken($token) { |
$token_decode = $this->decoderToken($token); |
216,4 → 232,4 |
return $headers; |
} |
} |
?> |
?> |