title: How to authenticate against federated GraphQL service on GCP Cloud Run?
body: <p>I have a series of microservices on GCP Cloud Run that are each hosting a federated Apollo GraphQL service. I then have one last container which is acting as a federated GraphQL gateway for the rest of the services.</p>
  
  <p>This works fine when public access is enabled on the containers but I cannot get the gateway server to authenticate against the other two services.</p>
  
  <p>I have tried using the Apollo RemoteGraphQLDataSource and implementing the willSendRequest method to set the neccessary headers.</p>
  
  <p>I have also tried adding the cloud run invoker role to the service role that the gateway runs as.</p>
  
  <pre class="lang-js prettyprint-override"><code>const servicex = new RemoteGraphQLDataSource({
    url: serviceurl,
    willSendRequest({ request, context }) {
      request.http.headers.set(
        "Authorization",
        "Bearer ${TOKEN}"
      );
    }
  });
  
  
  const gateway = new ApolloGateway({
    serviceList: [
      servicex
    ]
  });
  
  const { schema, executor } = await gateway.load();
  
  const server = new ApolloServer({ schema, executor })
  </code></pre>
  
  <p>I expect the gateway server to be able to authenticate against the other microservices.</p>