question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Per-request AddCredential not working with BatchRequest

See original GitHub issue

With the per-request credential example provided by @amanda-tarafa in #2064, I was able to get it working for services like Calendar and Oauth2. But I’m having trouble with GmailService.

I use GmailService via BatchRequest, like this

var cred = GoogleCredential.FromAccessToken(myToken);

var batchRequest = new BatchRequest(_gmailService);

foreach (var gmailMessage in gmailMessages)
{
    batchRequest.Queue<SendRequest>
        (_gmailService.Users.Messages.Send(gmailMessage, "me").AddCredential(cred), myCallback));
}

await batchRequest.ExecuteAsync();

I’m getting error:

Error 401, Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
amanda-tarafacommented, May 30, 2022

@mikequ-taggysoft Yes, this is still on my radar, but as @jskeet said some higher priority work popped up. We’ll work on this for sure.

1reaction
jskeetcommented, May 20, 2022

@mikequ-taggysoft: Amanda is currently on vacation, and when she’s back there are higher priorities. We haven’t forgotten about this and will get to it, but I’m afraid we do need to prioritize work that will affect more customers.

Read more comments on GitHub >

github_iconTop Results From Across the Web

OData batch request does not work well
I could get response data when I had sent request without batch so maybe Bearer token and URL are not wrong. Request POST...
Read more >
Combine multiple requests in one HTTP call using JSON ...
First JSON batch request; Request format; Response format ... For a list of current limitations related to batching, see known issues.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found