How to generate automatic api key when create the user

How to generate automatic api key when create the user.