Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Perl version of python-jose (Javascript Object Signing and Encryption)?

by tangent (Vicar)
on Sep 10, 2019 at 23:19 UTC ( #11105994=note: print w/replies, xml ) Need Help??


in reply to Perl version of python-jose (Javascript Object Signing and Encryption)?

Looking through the github docs I notice that the payload has an 'exp' attribute (expiration time) which the python script deals with like so:
if time.time() > claims['exp']: print('Token is expired') return False
Using Crypt::JWT you need to specify what to do with 'exp' by passing a value for 'verify_exp':
verify_exp
undef (default) - Expiration Time 'exp' claim must be valid if present
0 - ignore 'exp' claim
1 - require valid 'exp' claim
If the payload has 'exp' and your arguments to decode_jwt() do not contain 'verify_exp' then you get the error you describe. You could try:
my $data = decode_jwt(token=>$token, kid_keys=>$keylist, verify_exp=>1 +);

Replies are listed 'Best First'.
Re^2: Perl version of python-jose (Javascript Object Signing and Encryption)?
by scorpio17 (Canon) on Sep 11, 2019 at 12:47 UTC

    That was it!

    The test token had expired, so to ignore that and decode it anyway, I needed verify_exp=>0.
    I knew I was probably overlooking something simple- thank you so much!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11105994]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2022-01-19 15:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (55 votes). Check out past polls.

    Notices?