JWT auth null 문제가 발생해서 추적을 해봤더니
public static Claims extractToken(String token) {
Claims claims = null;
try {
claims = Jwts.parser().verifyWith(key).build().parseSignedClaims(token).getPayload();
} catch (ExpiredJwtException e) {
System.out.println("토큰이 만료되었습니다.");
} catch (JwtException e) {
System.out.println("JWT 파싱 오류: " + e.getMessage());
}
return claims;
}
}
위의 메서드에서 token값은 잘 가지고 오는데
claims = Jwts.parser().verifyWith(key).build().parseSignedClaims(token).getPayload(); 에서 claims가 null이 나옵니다.
에러메시지에는 JWT 파싱 오류: JWT signature does not match locally computed signature. JWT validity cannot be asserted and should not be trusted.
이렇게 나오는데 해결방법을 모르겠습니다.ㅠㅠ
-
이 게시글은
sj에 의해 3 월 전에 수정됐습니다.