Verify
Overview
Verify parses and validates a JWT with secret (jwt.verify).
If you are coming from Node.js, the closest pattern is jwt.verify(token, secret).
Signature
go
func Verify(token string, secret []byte) (jwtlib.MapClaims, error)Compare: Node.js · Standard Go · gox
js
const payload = jwt.verify(token, secret);go
// use golang-jwt directlygo
import "github.com/sahilkhaire/gox/jwt"
claims, err := jwt.Verify(token, secret)Example
go
import "github.com/sahilkhaire/gox/jwt"
claims, err := jwt.Verify(token, secret)Tips
Import github.com/sahilkhaire/gox/jwt and call Verify directly. See the comparison below for the standard library equivalent.
Standard library alternative
Use the standard library directly:
go
// use golang-jwt directly