lua-resty-jwt icon indicating copy to clipboard operation
lua-resty-jwt copied to clipboard

Validation example throws exception due to validate function 3rd argument being a number and not object/table

Open AlexeyAtIgloo opened this issue 8 years ago • 0 comments

Been playing around with guard examples and noticed the following:

Getting this exception:

2017/09/12 13:26:07 [error] 7#7: *5 lua entry thread aborted: runtime error: /usr/local/openresty/site/lualib/resty/jwt.lua:696: bad argument #1 to 'pairs' (table expected, got number)
stack traceback:
coroutine 0:
	[C]: in function 'pairs'
	/usr/local/openresty/site/lualib/resty/jwt.lua:696: in function 'validate_claims'
	/usr/local/openresty/site/lualib/resty/jwt.lua:728: in function 'verify'
	/usr/local/openresty/nginx/conf/lua/jwtguard.lua:13: in function </usr/local/openresty/nginx/conf/lua/jwtguard.lua:1>, client: ..., server: localhost, request: "GET /test/ HTTP/1.1", host: "..."

My token does not have any claim and seems like 3rd argument on below line causing this issue: here

If 3rd argument removed, everything seems to work as expected.

Thanks for a great library!

AlexeyAtIgloo avatar Sep 12 '17 13:09 AlexeyAtIgloo