auth/ComputeEngine.php
public function acquireAccessToken()
  {
    $request = new Request(
        self::METADATA_AUTH_URL,
        'GET',
        array(
          'Metadata-Flavor' => 'Google'
        )
    );
    $request->disableGzip();
    $response = $this->client->getIo()->makeRequest($request);

    if ($response->getResponseHttpCode() == 200) {
      $this->setAccessToken($response->getResponseBody());
      $this->token['created'] = time();
      return $this->getAccessToken();
    } else {
      throw new Exception(
          sprintf(
              "Error fetching service account access token, message: '%s'",
              $response->getResponseBody()
          ),
          $response->getResponseHttpCode()
      );
    }
  }
public function acquireAccessToken()
  {
    $request = new Request(
        self::METADATA_AUTH_URL,
        'GET',
        array(
          'Metadata-Flavor' => 'Google'
        )
    );
    $request->disableGzip();
    $response = $this->client->getIo()->makeRequest($request);

    if ($response->getResponseHttpCode() == 200) {
      $this->setAccessToken($response->getResponseBody());
      $this->token['created'] = time();
      return $this->getAccessToken();
    } else {
      throw new Exception(
          sprintf(
              "Error fetching service account access token, message: '%s'",
              $response->getResponseBody()
          ),
          $response->getResponseHttpCode()
      );
    }
  }
public function acquireAccessToken ( ) { $ request = new Request ( self :: METADATA_AUTH_URL , 'GET' , array ( 'Metadata-Flavor' => 'Google' ) ) ; $ request -> disableGzip ( ) ; $ response = $ this -> client -> getIo ( ) -> makeRequest ( $ request ) ; if ( $ response -> getResponseHttpCode ( ) == 200 ) { $ this -> setAccessToken ( $ response -> getResponseBody ( ) ) ; $ this -> token [ 'created' ] = time ( ) ; return $ this -> getAccessToken ( ) ; } else { throw new Exception ( sprintf ( "Error fetching service account access token, message: '%s'" , $ response -> getResponseBody ( ) ) , $ response -> getResponseHttpCode ( ) ) ; } }
Acquires a new access token from the compute engine metadata server.
@throws Exception
Acquires a new access token from the compute engine metadata server .