I need a JSON Web Key for my client to access the IRS E-services system.
The following fields are required in the JWK: kid, kty, use, n, e, x5t, x5c.
The kty field should be equal to "RSA".
I want to do self-signed. I get an error exception with everything I have tried.

I was in the same boat but I got it working now.
Go to https://mkjwk.org/ make an RSA key with
Size: 2048,
Key Use: Signature
Algorithm: RS256: RSA
Key ID: Specify : 20190607
Show X.509 : Yes
Hit generate.
Take the "Public and Private Keypair Set" json remove all but kty, kid, use, n, e
Take contents of "Self-Signed Certificate"
Remove -----BEGIN CERTIFICATE-----
Remove -----END CERTIFICATE-----
Remove all Whitespace
add this to the json as x5c:["cert_code_here"]
add the sha1("cert_code_here") to the json as x5t (Note this is NOT base 64 encoded like it should be according to other JWK consumers)
Should end up with something like this
OR use this PHP I wrote