diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs index 34d5157d3e70433f2df09d4407163836e722e6e5..0884c6ea60a39f49b424cb1ac0e400bdb4e69644 100644 --- a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs +++ b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs @@ -166,7 +166,7 @@ namespace Grpc.IntegrationTesting await RunOAuth2AuthTokenAsync(client, options.DefaultServiceAccount, options.OAuthScope); break; case "per_rpc_creds": - await RunPerRpcCredsAsync(client, options.DefaultServiceAccount); + await RunPerRpcCredsAsync(client, options.DefaultServiceAccount, options.OAuthScope); break; case "cancel_after_begin": await RunCancelAfterBeginAsync(client); @@ -391,14 +391,11 @@ namespace Grpc.IntegrationTesting Console.WriteLine("Passed!"); } - public static async Task RunPerRpcCredsAsync(TestService.TestServiceClient client, string defaultServiceAccount) + public static async Task RunPerRpcCredsAsync(TestService.TestServiceClient client, string defaultServiceAccount, string oauthScope) { Console.WriteLine("running per_rpc_creds"); - - ITokenAccess credential = await GoogleCredential.GetApplicationDefaultAsync(); - // TODO: currently there's no way how to obtain AuthURI for JWT per-rpc creds. - string authUri = "https://grpc-test.sandbox.google.com/grpc.testing.TestService"; - string accessToken = await credential.GetAccessTokenForRequestAsync(authUri); + ITokenAccess credential = (await GoogleCredential.GetApplicationDefaultAsync()).CreateScoped(new[] { oauthScope }); + string accessToken = await credential.GetAccessTokenForRequestAsync(); var headerInterceptor = AuthInterceptors.FromAccessToken(accessToken); var request = new SimpleRequest