private function makeSignedJwt($payload) { $header = array("typ" => "JWT", "alg" => "RS256"); $segments = array(); $segments[] = apiOAuth2::urlSafeB64Encode(json_encode($header)); $segments[] = apiOAuth2::urlSafeB64Encode(json_encode($payload)); $signing_input = implode(".", $segments); $signature = $this->signer->sign($signing_input); $segments[] = apiOAuth2::urlSafeB64Encode($signature); return implode(".", $segments); }