google-api-dotnet-client: GetAccessTokenForRequestAsync response token missing kid in header
I have been converting code from Java version to .NET version.
Issue we ran into is that when we get a bearer token for API calls, the .NET version is missing the “kid” field in the header of the JWT token. Otherwise token is valid.
.NET :
_credentials = ServiceAccountCredential.FromServiceAccountData(File.OpenRead(serviceAccountFile));
_token = _credentials.GetAccessTokenForRequestAsync(_audience).Result;
Java :
ServiceAccountJwtAccessCredentials credentials = null;
credentials = ServiceAccountJwtAccessCredentials.fromStream( new FileInputStream( accountFile ),
new URI( audience ) );
String token = credentials.getRequestMetadata( ).get( HttpHeaders.AUTHORIZATION )
.get( 0 );
Tokens are otherwise identical and correct. However, the missing kid field is causing error. Both audience and account file are the same.
Are we doing something wrong here, is there a bug in the GetAccessTokenForRequestAsync function?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 19 (10 by maintainers)
Hi, I am happy to report that everything works. Thank you @amanda-tarafa for your help!
Thanks! I will report back tomorrow if there is an issue after I have updated everything and ran the tests.