Fully functional version with random access and refresh token generation