We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug There's a syntax issue in the JWT token's payload: it contains a trailing comma. Here's how the decoded payload appears:
{ "iat": 1736252478, "exp": 1736252838, "iss": "NAME", "sub": "admin", }
Expected behavior
Expected decoded payload:
{ "iat": 1736252478, "exp": 1736252838, "iss": "NAME", "sub": "admin" }
To Reproduce
type JWTService struct { signer *jwt.Signer verifier *jwt.Verifier } func newJWTService() *JWTService { private, public := jwt.MustLoadRSA(config.PrivateKey, config.PublicKey) return &JWTService{ signer: jwt.NewSigner(jwt.RS256, private, config.AccessTokenMaxAge), verifier: jwt.NewVerifier(jwt.RS256, public), } } func (s *JWTService) GenerateTokenPair(user model.User) (jwt.TokenPair, error) { now := time.Now() // Create refresh claims with user ID as subject refreshClaims := jwt.Claims{ Subject: fmt.Sprintf("%s", user.Username), Issuer: "NAME", IssuedAt: now.Unix(), Expiry: now.Add(time.Second * s.config.RefreshTokenMaxAge).Unix(), } // Create access claims with user details accessClaims := jwt.Claims{ Subject: fmt.Sprintf("%s", user.Username), Issuer: "NAME", IssuedAt: now.Unix(), Expiry: now.Add(time.Second * s.config.AccessTokenMaxAge).Unix(), } tokenPair, err := s.signer.NewTokenPair(accessClaims, refreshClaims, s.config.RefreshTokenMaxAge) if err != nil { return jwt.TokenPair{}, err } fmt.Printf("access token: %s\n", tokenPair.AccessToken) return tokenPair, nil }
iris.Version
The text was updated successfully, but these errors were encountered:
kataras
No branches or pull requests
Describe the bug
There's a syntax issue in the JWT token's payload: it contains a trailing comma. Here's how the decoded payload appears:
Expected behavior
Expected decoded payload:
To Reproduce
iris.Version
The text was updated successfully, but these errors were encountered: