728x90
Token used before issued

 

 Go๋กœ ์งœ์ธ API๋ฅผ ์‚ฌ์šฉํ•˜๋‹ค๊ฐ€ ๋งŒ๋‚œ Error "401 Token used before issued" ์ด ๋ฌธ์ œ๋Š” jwt decode ์œ ํšจ์„ฑ ๊ฒ€์ฆ ๊ณผ์ •์—์„œ ์‹คํŒจํ•ด์„œ ์ƒ๊ธด ๋ฌธ์ œ๋‹ค. ๋‚˜์˜ ๊ฒฝ์šฐ iat((Issued At: ์š”์ฒญ ์‹œ๊ฐ„))๊ฐ€ ์œ ํšจ์„ฑ ๊ฒ€์ฆ์„ ํ†ต๊ณผํ•˜์ง€ ๋ชปํ•ด ๋ฐœ์ƒํ•˜๋Š” ๊ฒƒ์„ ํ™•์ธํ–ˆ๋‹ค. iat๋Š” ์š”์ฒญ ์‹œ๊ฐ„์ธ๋ฐ ์š”์ฒญ ์‹œ๊ฐ„์ด API๊ฐ€ ๋ฐ›์€ ์‹œ๊ฐ„๊ณผ ๋‹ฌ๋ผ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค. ์ด ์ผ€์ด์Šค๋Š” API์™€ ๋ณ„๊ฐœ๋กœ ์š”์ฒญํ•˜๋Š” ๊ณณ์—์„œ iat ๊ฐ’์„ ๋ฐ€๋ฆฌ์„ธ์ปจ๋“œ์—์„œ ๋‹ค์‹œ ์ •์ˆ˜๋กœ ๋ณ€ํ™˜((์–ธ์–ด๋งˆ๋‹ค ๋‹ค๋ฆ„))ํ•˜๋Š” ๊ณผ์ •์—์„œ ์ƒ๊ธฐ๋Š” ๋ฌธ์ œ๋กœ ๋ฐ˜์˜ฌ๋ฆผ ๊ณผ์ •์—์„œ ๋ฌธ์ œ๊ฐ€ ์ƒ๊ธด๋‹ค.

 

 ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์€ iat ๊ฐ’์„ ๊ฒ€์ฆํ•˜๋Š” ๊ณณ์—์„œ ((mapClaims["iat"].(float64)) -= 5)) ์ผ์ • ๋ณด์ •์„ ํ†ตํ•ด ๊ฒ€์ฆ์„ ํ†ต๊ณผํ•˜๊ฒŒ ํ•˜๊ฑฐ๋‚˜ clockTolerance์™€ ๊ฐ™์€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์ด์šฉํ•ด ๋ณด์ •์„ ํ•˜๋Š” ๋ฐฉ๋ฒ•์ด๋‹ค. 

 

** golang-jwt 5 ๋ฒ„์ „์—์„œ๋Š” ์œ ํšจ์„ฑ ๊ฒ€์ฆ์„ ์ˆ˜์ •์ด ๋˜์–ด ํ˜„์žฌ๋Š” ํ•ด๊ฒฐ๋˜์—ˆ์ง€๋งŒ ๊ตฌ๋ฒ„์ „์€ ์œ„์™€ ๊ฐ™์ด ํ•ด๊ฒฐํ•ด์•ผ ํ•œ๋‹ค.

 

https://github.com/dgrijalva/jwt-go/issues/383

 

"Token used before issued" ยท Issue #383 ยท dgrijalva/jwt-go

When running Go program on my mac, I am receiving the following error when parsing a JWT: "Token used before issued". However, when I am running on a remote server it is working fine. What causes t...

github.com

 

 

https://github.com/dgrijalva/jwt-go/issues/314

 

"Token used before issued" when checking 'iat' ยท Issue #314 ยท dgrijalva/jwt-go

I have out of sync problem. Time on php server is different for a fraction of a second and because of this there is a problem when checking the token Token used before issued. Is it possible to mak...

github.com

 

 

๋ฐ˜์‘ํ˜•
๋‹คํ–ˆ๋‹ค