Sign JWT token using Azure Key Vault
See original GitHub issueHi. Apologies if it’s bad form to link straight to my StackOverflow question - I thought I’d save on the duplication. I’m happy to copy across the content if that’s preferred.
Basically, I’m having trouble signing a JWT via Azure Key Vault. It works fine if I don’t use Azure Key Vault. I put code example and full description in the Stackovlow question…
https://stackoverflow.com/questions/69117288/sign-jwt-token-using-azure-key-vault
Environment:
- Name and version of the Library package used: Azure.Security.KeyVault.Keys 4.2.0
- Hosting platform or OS and .NET runtime version (
dotnet --info
output for .NET Core projects): LINQPad 6 (which I believe is .NET 5 runtime) - IDE and version : LINQPad 6
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Sign JWT token using Azure Key Vault
I'm using a private key to sign a JWT token, which works as expected. However, I'd like to leverage Azure Key Vault to...
Read more >Get KeyVault certificate (or Keys) and Sign/Validate string
We have a sample policy snippet here which retrieve the secret from Azure Key Vault using named values and generate JWT token with...
Read more >Azure Key Vault Secrets - BUILD A JWT AUTHENTICATION ...
Learn how to setup Azure Key Vault to manage secrets across several applications. Azure Key Vault is a great solution for centralizing a...
Read more >Sign JWT token using Azure Key Vault - appsloveworld.com
I was able to get this to work and found that https://jwt.io is rather vague when it says you can paste either a...
Read more >jwt-go signing methods backed by Azure Key Vault
jwt-go signing methods backed by Azure Key Vault. ... NewKey(client, kid) fail(err) // Generate a JWT token token := jwt.
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
Great!
FWIW, one thing I’ve learned over the years is that Windows-based APIs are often Unicode, i.e. wide chars, but industry standards more often tend to be UTF-8 based - JWTs and the family included.
Encoding.UTF8
is technically correct in this case, but there’s the potential for more processing involved when, because the value is base64url-encoded, you know all the characters are ASCII already.@heaths - that’s amazing, it worked! 😃 It was literally just the changing from
Encoding.Unicode.
toEncoding.ASCII.
that fixed it for me. Amazing how a single word can cause so many problems! The public keys that I pasted into jwt.io were all-----BEGIN CERTIFICATE-----
, but I think that was fine. The tokens also weren’t working against the endpoint I was trying to authenticate against either - so it wasn’t just jwt.io. UsingEncoding.ASCII
, it all works perfectly! Thank you so much for your help with this 😃