У меня много трудностей при переходе от общеизвестного URL.json к получению заявок и их внутреннему использованию.
Моя самая большая проблема сейчас заключается в анализе JWK от известного jsonстрока в открытый ключ для проверки моих токенов с помощью.
import (
"fmt"
"github.com/dgrijalva/jwt-go"
"github.com/lestrrat-go/jwx/jwk"
)
func main() {
// I have a JWK that contains a key encoded using RS256
set, _ := jwk.ParseString(jwkString)
// This doesn't return a public key
// Is this the right way to get a public key back from the string?
publicKey, _ := set.Keys[0].Materialize()
token, _ := jwt.Parse("<token string>", func(*jwt.Token) (interface{}, error) {
return []byte(publicKey), nil
})
// Do I have to manually cast the claims to typed variables for use?
email := fmt.Sprint(token.Claims.(jwt.MapClaims)["email"])
fmt.Println ("электронная почта" + электронная почта)}