jwt
jwt copied to clipboard
Example requested: RS256 and .well-known/openid-configuration/jwk
Just need to authenticate a JWT token, I have the URL to the .well-known... set, not sure how to use the library to get the public key and provide to the decode function
I presume you're implementing an OIDC flow, in which case you might want to take a look at https://github.com/coreos/go-oidc
It handles fetching the public key(s) from the discovery endpoint and leverages https://github.com/square/go-jose
I believe that URL pattern typically leads to a "JWK Set". In the README.md
of this repository, you'll see that github.com/MicahParks/keyfunc
is mentioned as an extension for JWKS (JWK Set).
Here's an example from keyfunc
:
https://github.com/MicahParks/keyfunc/blob/master/examples/recommended_options/main.go
Please note that the OpenID Connect (OIDC) and OAuth 2.0 protocols are complex and in most cases you should use high level libraries to ensure your code is fully compliant.