JWT authentication Internal Server Error
After long hours trying figure out how perform token from app user I have problem with JWT.
I try with differents libs the only that works https://github.com/cghil/cmd-line-tok-generator, but on my server don`t run node, so I only can use this localhost tests
I`m using CURL and $.post() both return the same error i don`t know what to do.
I set my timezone to date_default_timezone_set('UTC') sincronize my timezone with http://www.unixtimestamp.com/
but continuous receive same error: {"error":"invalid_grant","error_description":"Please check the 'exp' claim."}
I pass "exp" with value integer timestamp generate with strtotime();
-
Hi lukasfigueiredo,
Are you setting exp to the exact time returned by strtotime()? If so, that might be the issue. You'll want to set exp to the current timestamp, plus an additional 1-60 seconds in the future (the grant is valid for up to 60 seconds). For instance, here's how I'm setting it in Node / JS, adding an additional 45 seconds in the future.
exp: Math.floor(Date.now() / 1000) + 45
Hopefully that helps,
Jon
Please sign in to leave a comment.
Comments
1 comment