jwt-cognito
is a helper package that will allow you to validate quickly and seamlessly jwt token created by AWS cognito
go get github.com/AyWa/jwt-cognito
For more usage see the godoc ~
import (
"fmt"
cognito "github.com/AyWa/jwt-cognito"
)
// Initialize the cognito helper: aws cognito region, aws cognito userPool id
auth := cognito.New("us-east-1", "us-east-1_XXXXXXX")
// validate a token
// It will return error if the token is not valid
payload, err := auth.ValidateToken("xx.yy.zz")
if err != nil {
panic(err)
}
// you can use the payload to get the user info etc
fmt.Println(payload[email])