stephenplusplus / google-auto-auth

Making it as easy as possible to authenticate a Google API request
MIT License
34 stars 9 forks source link

Make the projectId optional for signing with IAM #53

Closed hiranya911 closed 6 years ago

hiranya911 commented 6 years ago

The signWithApi method currently requires a projectId field:

_signWithApi (data, callback) {
    if (!this.projectId) {
      callback(new Error('Cannot sign data without a project ID.'));
      return;
    }
    ...
}

However, IAM's signBlob endpoint can be called without a projectId if necessary (using - as a wildcard):

/projects/-/serviceAccounts/${clientEmail}

Can we modify the implementation to default to - wildcard when a projectId is not given explicitly? This will greatly simplify the usage of the library in some high-level applications, such as firebase-admin.

stephenplusplus commented 6 years ago

This issue was moved to https://github.com/google/google-auth-library-nodejs/issues/421.