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.

Provide a DelegatingHandler for HttpClient for calling protected Cloud Run / Cloud Function instances

See original GitHub issue

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

Is your feature request related to a problem? Please describe. We often have to call Cloud Run or Cloud Function instances that require authentication (An account with the invoker role).

Describe the solution you’d like It’d be great if there was a DelegatingHandler for the HttpClient that would take care of getting the proper token for different account types (service account, user credentials) and setting the Authorization header accordingly.

Describe alternatives you’ve considered We wrote a custom handler that we copy in multiple projects, and it works, but we’re not sure if we’re following best practices with it comes to handling the tokens

Additional context Reference doc of what we’re trying to do https://cloud.google.com/run/docs/authenticating/service-to-service (note: This doc has no example for .NET unfortunately) https://cloud.google.com/run/docs/authenticating/developers

Issue Analytics

  • State:closed
  • Created 3 months ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
jskeetcommented, Jul 5, 2023

@EricStG: If you could leave it with us for a few days to discuss internally, we can get back to you - I think the main question is whether this should be a standalone library (which would be better from a consumption perspective, but more work) or part of Google.Apis.Auth (which would probably be relatively straightforward, but come with baggage).

0reactions
jskeetcommented, Jul 7, 2023

Great! Will adds tests, documentation etc next week. We may find we need to add creds-only retries at some point, but let’s start simple…

Read more comments on GitHub >

github_iconTop Results From Across the Web

HttpClient Message Handlers in ASP.NET Web API
This pattern is called a delegating handler. Diagram of message handlers chained together, illustrating process to receive an H T T P request ......
Read more >
Allowing public (unauthenticated) access | Cloud Run ...
You can allow unauthenticated invocations to a service by assigning the IAM Cloud Run ... From the Role dropdown menu, select the Cloud...
Read more >
Creating and Using HTTP Client SDKs in .NET 6 - InfoQ
In this article, the author explains the process behind developing HTTP Client SDKs in .NET 6. The article also contains a sample SDK ......
Read more >
How to use IHttpClientFactory in ASP.NET Core
To create an HttpClient using IHttpClientFactory, you should call the CreateClient method. Once the HttpClient instance is available, you can ...
Read more >
Working with the HttpClient Class - Simple Talk
One way to call up an endpoint using the HttpClient class is to do the following: ... The static singleton's new instance is...
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