일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- spring mongodb
- javav 1676
- 익명 객체 @transactional
- spring mongodb switch
- kotiln const
- java 1509
- 백준 2252 줄세우기
- nodejs rabbitmq
- rabbitmq 싱글톤
- 백준 연결요소 자바
- mongodb lookup
- java 팩토리얼 개수
- java 백준 1509
- java 파티
- 안정해시
- ipfs singletone
- spring mongoTemplate switch
- go
- Spring ipfs
- java 1238
- kotiln functional interface
- 백준 특정한 최단 경로
- 백준 1504 java
- ipfs bean
- spring mongoTemplate
- 자바 백준 팩토리얼 개수
- 전략 패턴이란
- Java Call By Refernce
- 자바 1676
- kotiln const val
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 |