feat(grpc): Google call credentials#2610
Open
arjan-bal wants to merge 12 commits intohyperium:masterfrom
Open
Conversation
sauravzg
approved these changes
Apr 29, 2026
| #[trait_variant::make(Send)] | ||
| pub trait TokenProvider: Sync + Debug + 'static { | ||
| /// Returns an authentication token. | ||
| async fn get_token(&self) -> Result<String, String>; |
Collaborator
There was a problem hiding this comment.
nit: Are we sure about String error type? It loses some context error context.
| S: Into<String>, | ||
| { | ||
| let credentials = google_cloud_auth::credentials::Builder::default() | ||
| .with_scopes(scopes) |
Collaborator
There was a problem hiding this comment.
For my education: Is scopes a mandatory argument and the default scope documented somewhere?
What happens if this isn't specified?
dfawley
approved these changes
Apr 29, 2026
Collaborator
dfawley
left a comment
There was a problem hiding this comment.
Looks good except for the nit about the comments.
| * | ||
| */ | ||
|
|
||
| //! GCP Credentials implementation for gRPC. |
Collaborator
There was a problem hiding this comment.
Please spell out what GCP stands for and ideally link to a site with more info.
| //! GCP Credentials implementation for gRPC. | ||
| //! | ||
| //! This crate provides a way to create gRPC channel credentials that | ||
| //! automatically fetch and attach Google Cloud Platform (GCP) authentication |
Collaborator
There was a problem hiding this comment.
Oh, just move the explanation from here then?
| @@ -0,0 +1,22 @@ | |||
| [package] | |||
| name = "grpc-google" | |||
| version = "0.9.0-alpha.1" | |||
| format!("invalid values in authorization header value: {}", e), | ||
| ) | ||
| })?; | ||
| value.set_sensitive(true); |
Collaborator
There was a problem hiding this comment.
Outside the scope of this PR: Is this not the default? I suspect we would want it to be.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces a
CallCredentialsimplementation that injects authentication tokens based on GCP Application Default Credentials (ADC), leveraging the officialgoogle-cloud-authcrate.To avoid pulling in Google-specific dependencies by default, the implementation is housed in a new
grpc-googlecrate. Additionally, to facilitate unit testing, the following types from thegrpccrate are now exported:attributesmodule.CallDetailsandClientConnectionSecurityInfo.The code was manually tested by running this example, which will be included in a follow-up PR.