updated token generate method