Cannot get token from ParseNotificationV2 func
Closed this issue · 7 comments
Daydaylw3 commented
here is the case
import (
"time"
"github.com/awa/go-iap/appstore"
"github.com/golang-jwt/jwt/v4"
)
// it is too long, i make short here
var signedPayload = `eyJhbGciOiJFUzI1...`
func main() {
token := &jwt.Token{}
if err := appstore.New().ParseNotificationV2(signedPayload, token); err != nil {
panic(err)
}
}
and no matter token
is a struct or pointer, just cannot be parsed.
but actually in ParseNotificationV2
there are not empty
richzw commented
Is there any error returned from ParseNotificationV2
?
Daydaylw3 commented
no, is the token always be empty
MakDon commented
IMHO, it is better that use ParseNotificationV2(tokenStr string) (result *jwt.Token, err error)
as the method signature.
richzw commented
IMHO, it is better that use
ParseNotificationV2(tokenStr string) (result *jwt.Token, err error)
as the method signature.
Yes, It could be better to use ParseNotificationV2(tokenStr string) (result *jwt.Token, err error)
. To use this method ParseNotificationV2(tokenStr string, result *jwt.Token) error
just follow the same signature of Verify
and VerifyWithStatus