Fix UserManager to change token generation depending on environment.