Skip to content

Commit 1a5085e

Browse files
vishrclaude
andcommitted
Fix JWT secret consistency in integration test
- Set JWT_SECRET environment variable consistently for both login and verification - Ensure login function and JWT middleware use the same secret - Fixes CI test failure where token verification failed due to secret mismatch 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent d63a10f commit 1a5085e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cookbook/jwt/custom-claims/server_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,11 @@ func TestRestricted(t *testing.T) {
156156
}
157157

158158
func TestJWTIntegration(t *testing.T) {
159+
// Set consistent secret for both login and verification
160+
secret := "test-secret"
161+
os.Setenv("JWT_SECRET", secret)
162+
defer os.Unsetenv("JWT_SECRET")
163+
159164
// Setup Echo server with all routes
160165
e := echo.New()
161166
e.HideBanner = true
@@ -165,7 +170,6 @@ func TestJWTIntegration(t *testing.T) {
165170

166171
// Restricted group with JWT middleware
167172
r := e.Group("/restricted")
168-
secret := "test-secret"
169173
config := echojwt.Config{
170174
NewClaimsFunc: func(c echo.Context) jwt.Claims {
171175
return new(jwtCustomClaims)

0 commit comments

Comments
 (0)