0

I have a JWT token with the claims below

{
  "authorized": true,
  "email": "sample@gmail.com",
  "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

Victor Timofei
  • 334
  • 4
  • 13

1 Answers1

1

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

tok,_,err := p.ParseUnverified(tokenString,&claimsStruct)
Burak Serdar
  • 46,455
  • 3
  • 40
  • 59