got a working GenerateToken method