src/Widop/GoogleAnalytics/Client.php
protected function generateJsonWebToken()
    {
        $exp = new \DateTime('+1 hours');
        $iat = new \DateTime();

        $jwtHeader = base64_encode(json_encode(array('alg' => 'RS256', 'typ' => 'JWT')));

        $jwtClaimSet = base64_encode(
            json_encode(
                array(
                    'iss'   => $this->clientId,
                    'scope' => self::SCOPE,
                    'aud'   => $this->url,
                    'exp'   => $exp->getTimestamp(),
                    'iat'   => $iat->getTimestamp(),
                )
            )
        );

        $jwtSignature = base64_encode($this->generateSignature($jwtHeader.'.'.$jwtClaimSet));

        return sprintf('%s.%s.%s', $jwtHeader, $jwtClaimSet, $jwtSignature);
    }
protected function generateJsonWebToken()
    {
        $exp = new \DateTime('+1 hours');
        $iat = new \DateTime();

        $jwtHeader = base64_encode(json_encode(array('alg' => 'RS256', 'typ' => 'JWT')));

        $jwtClaimSet = base64_encode(
            json_encode(
                array(
                    'iss'   => $this->clientId,
                    'scope' => self::SCOPE,
                    'aud'   => $this->url,
                    'exp'   => $exp->getTimestamp(),
                    'iat'   => $iat->getTimestamp(),
                )
            )
        );

        $jwtSignature = base64_encode($this->generateSignature($jwtHeader.'.'.$jwtClaimSet));

        return sprintf('%s.%s.%s', $jwtHeader, $jwtClaimSet, $jwtSignature);
    }
protected function generateJsonWebToken ( ) { $ exp = new \ DateTime ( '+1 hours' ) ; $ iat = new \ DateTime ( ) ; $ jwtHeader = base64_encode ( json_encode ( array ( 'alg' => 'RS256' , 'typ' => 'JWT' ) ) ) ; $ jwtClaimSet = base64_encode ( json_encode ( array ( 'iss' => $ this -> clientId , 'scope' => self :: SCOPE , 'aud' => $ this -> url , 'exp' => $ exp -> getTimestamp ( ) , 'iat' => $ iat -> getTimestamp ( ) , ) ) ) ; $ jwtSignature = base64_encode ( $ this -> generateSignature ( $ jwtHeader . '.' . $ jwtClaimSet ) ) ; return sprintf ( '%s.%s.%s' , $ jwtHeader , $ jwtClaimSet , $ jwtSignature ) ; }
Generates the JWT in order to get the access token.

@return string The Json Web Token (JWT).
Generates the JWT in order to get the access token .