Skip to content

Instantly share code, notes, and snippets.

@eldermoraes
Created December 13, 2018 15:13
Show Gist options
  • Save eldermoraes/c5bf75dd48173f2fd1bb15ad277f04da to your computer and use it in GitHub Desktop.
Save eldermoraes/c5bf75dd48173f2fd1bb15ad277f04da to your computer and use it in GitHub Desktop.
public class TokenUtils {
public static String generateToken() {
SecureRandom random = new SecureRandom();
long longToken = Math.abs(random.nextLong());
return Long.toString(new Date().getTime()) + Long.toString(longToken, 16);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment