GetAccessTokenForRequestAsync response token missing kid in header
See original GitHub issueI 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?
Issue Analytics
- State:
- Created 3 years ago
- Comments:19 (10 by maintainers)
Top Results From Across the Web
JWT token missing part of header on .NET, but not in Java
NET the token we receive for authentication is missing part of the header ... NET token is missing "kid" part. .NET token header...
Read more >Access token suddenly stopped containing the `kid` header
Today the access token stopped containing the kid header which means that we can no longer decode it. We've not made any changes...
Read more >Access token header 'kid' missing - Troubleshooting
I'am generating an access token, when I decode the JWT, I get only the stuff below without the “kid” to be able to...
Read more >KID in id_token header not matching kid in metadata
When I request a token and ID token the kid claim in the header does not match the key ids in the /keys...
Read more >Performance tips | Generic pass
In order to receive a gzip-encoded response you must do two things: Set an Accept-Encoding header, and modify your user agent to contain...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.