Skip to content

Client's authClient not being used by request #83

@bryanburgers

Description

@bryanburgers

When an AuthClient is set on a Client using client.withAuthClient(oauth2client), that AuthClient is not used when making a request.

Example

Assuming I have a valid oauth2client and a valid client

// Or something like this
var oauth2client = getAuthClient();
var client = createAndDiscoverClient();

The following works:

client.analytics.management.profiles.list(data)
  .withAuthClient(oauth2client)
  .execute(function (err, result) {
    // Gets the result that I want
  });

I expect the following to work, but it does not. It returns with an error saying that authentication is needed.

client = client.withAuthClient(oauth2client);

client.analytics.management.profiles.list(data)
  .execute(function (err, result) {
    // Gets a not authenticated error
  });

The following works, proving that the authClient is getting set on the client, but it's just not making its way down to the request.

client = client.withAuthClient(oauth2client);

client.analytics.management.profiles.list(data)
  .withAuthClient(client.authClient)
  .execute(function (err, result) {
    // Gets the result that I want
  });

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.triage meI really want to be triaged.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions