Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

jwt token expire times

// it uses npmjs.com/ms utility to convert various time formats to milliseconds
// milliseconds is the default format which is assumed if numeric value is not followed by valid characters
var token = jwt.sign({key_name:'key_value'}, "secret_key", {
  expiresIn: '365d'	// expires in 365 days
});

// other accepted formats
expiresIn('2 days')  // 172800000
expiresIn('1d')      // 86400000
expiresIn('10h')     // 36000000
expiresIn('2.5 hrs') // 9000000
expiresIn('2h')      // 7200000
expiresIn('1m')      // 60000
expiresIn('5s')      // 5000
expiresIn('1y')      // 31557600000
expiresIn('100')     // 100
expiresIn('-3 days') // -259200000
expiresIn('-1h')     // -3600000
expiresIn('-200')    // -200
Comment

PREVIOUS NEXT
Code Example
Javascript :: vue get store state 
Javascript :: lodash pascal case 
Javascript :: how to copy to clipboard in react js 
Javascript :: angular create guard 
Javascript :: get ip of user in node js 
Javascript :: javascript every other element in array 
Javascript :: jest expect error to be thrown 
Javascript :: express async errors 
Javascript :: snap to grid 
Javascript :: js filter undefined from array 
Javascript :: mongodb add admin user 
Javascript :: replace string in javascript 
Javascript :: jest testmatch specific folder 
Javascript :: laravel query json 
Javascript :: import json data in js file 
Javascript :: tolowercase 
Javascript :: for of with index 
Javascript :: string interpolation javascript 
Javascript :: video preview javascript 
Javascript :: event listener javascript 
Javascript :: materialize for react 
Javascript :: js desktop notification 
Javascript :: angular formData print values 
Javascript :: postman test check response status 
Javascript :: jquery select clear options 
Javascript :: remove one array from another javascript 
Javascript :: get parent html js 
Javascript :: sum of digits in a whole number javascript 
Javascript :: usereducer hook react 
Javascript :: where to place async in const function 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =