일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
Tags
- nodejs rabbitmq
- go
- kotiln const val
- java 1238
- 자바 1676
- 백준 1504 java
- java 팩토리얼 개수
- Spring ipfs
- rabbitmq 싱글톤
- 안정해시
- kotiln functional interface
- 자바 백준 팩토리얼 개수
- 백준 연결요소 자바
- Java Call By Refernce
- kotiln const
- javav 1676
- ipfs singletone
- java 파티
- spring mongodb
- spring mongodb switch
- 전략 패턴이란
- 백준 특정한 최단 경로
- 익명 객체 @transactional
- 백준 2252 줄세우기
- ipfs bean
- mongodb lookup
- java 1509
- java 백준 1509
- spring mongoTemplate switch
- spring mongoTemplate
Archives
- Today
- Total
공부 흔적남기기
JWT signature does not match locally computed signature. JWT validity cannot be asserted and should not be trusted. 본문
web study
JWT signature does not match locally computed signature. JWT validity cannot be asserted and should not be trusted.
65살까지 코딩 2025. 1. 22. 22:50728x90
반응형
분명히 같은 키를 사용하고 똑같은 알고리즘을 통해서 암호화 복호화를 하는데 에러가 나서 삽질을 했다..
JWT signature does not match locally computed signature. JWT validity cannot be asserted and should not be trusted.
수정전 코드 토큰 발급
val token = Jwts.builder()
.subject(user.userId)
.expiration(Date(System.currentTimeMillis() + jwtProperties.expire))
.signWith(key, Jwts.SIG.HS256)
.compact()
수정 후 코드 토큰 발급
val token = Jwts.builder()
.subject(user.userId)
.expiration(Date(System.currentTimeMillis() + jwtProperties.expire))
.signWith(key)
.compact()
당연히 SignWith를 할떄 Jwts.SIG.HS256 를 명시해주는게 좋을거라고 생각했지만 삽질의 원인이 되었다.
설마하고 Jwts.SIG.HS256를 뺴보았더니 잘 되었다..
복호화 코드
Jwts.parser().verifyWith(secretKey).build().parseSignedClaims(jwt).payload.subject
728x90
반응형
'web study' 카테고리의 다른 글
Kotiln const val를 사용하는 이유 (0) | 2025.01.29 |
---|---|
nginx location와 root를 이용해서 url로 포워딩하기 (php-fpm 사용시 주의점) (0) | 2025.01.27 |