Skip to content

Create gcloud-node client that uses metadata service auth #511

Description

@drewbryant

How can I force the gcloud-node client to attempt to use the compute engine environment, which relies upon the "metadata service" for getting auth tokens?

I see this chunk of code in lib/storage/index.js, and I don't see where/how it is checking for the compute engine environment:

function Storage(config) {
  if (!(this instanceof Storage)) {
    return new Storage(config);
  }

  this.makeAuthorizedRequest_ = util.makeAuthorizedRequest({
    credentials: config.credentials,
    keyFile: config.keyFilename,
    scopes: SCOPES
  });

  this.projectId = config.projectId;
}

Basically I'm attempting to create my client like this:

var gcloud = require('gcloud');
var storage = gcloud.storage();

And I'm hitting an error because I haven't passed a config object with credentials. The docs here made it seem like this was the expected syntax on compute engine however (i.e., gcloud.storage()).

Is this auth approach supported currently?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

coretype: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions