0
votes

I have a JWT token with the claims below

{
  "authorized": true,
  "email": "[email protected]",
  "exp": 1589929351,
  "node": "/auth/nodes0000000023",
  "role": "admin"
}

The issuer of the JWT is the claims['node']. In the above claims it is the /auth/nodes0000000023. How do I extract the issuer from the token without verifying the token. I want to get the issuer name so that I can go find his publicKey from a map and then verify the token.

I have found the function func (*Parser) ParseUnverified in the docs, but it is unclear on how to use it.

The library used is github.com/dgrijalva/jwt-go

1
it can be good idea to post library you use to parse JWT tokensvodolaz095
ohh forgot it, thnx mateVictor Timofei
You use it the same way you use parse: tok,_,er=ParseUnverified(tokenString,&claimsStruct)Burak Serdar
Thanks it worked, you can add it as an answer.Victor Timofei

1 Answers

1
votes

You can use the unverified parse API the same way you use the verified API:

tok,_,err := p.ParseUnverified(tokenString,&claimsStruct)