AppStoreConnect-JWT-Go is a Go package that provides an easy way to generate JWT token needed for accessing AppStoreConnect API. This package handles token reuse (returns same token if previously issued token was not expired) and is thread safe.
AppStoreConnect JWT Token requirements.
client, err := jwt.New(cfg)
if err != nil {
panic(err)
}
tokenString, err := client.BearerToken()
if err != nil {
panic(err)
}
fmt.Println(tokenString)
Result:
$ go run example/main.go
eyJhbGciOiJFUzI1NiIsImtpZCI6IjJYOVI0SFhGMzQiLCJ0eXAiOiJKV1QifQ.eyJhdWQiOiJhcHBzdG9yZWNvbm5lY3QtdjEiLCJleHAiOjE1NjQ1OTQ0NzEsImlhdCI6MTU2NDU5Mzg3MSwiaXNzIjoiNTcyNDY1NDItOTZmZS0xYTYzLWUwNTMtMDgyNGQwMTEwNzJhIn0.Tpqv1ZoDcv7CsDaq4ZF8bycN3hJexYrBQbzsUEd6hNV94bQ_gIES1nsCDlF9-JMrWlT7sa
1ET2kZcWBezfUe5w
- A few more tests
- Remove dependency on jwt-go package
- Document more code