I am creating G Suite user accounts programmatically through a web app powered by Google Apps Script.
The flow I am following when doing this manually is the following:
- Create the user
- Go through the "reset password" flow
- Send a password reset link to the user
This enables me to create the users and allow them to set their own password, without having to send them the initial password. I would like to follow the same flow for the user creation through Apps Script, if possible.
However, in the documentation for the Directory API, it seems like I can only reset the password and force the user to reset it on their next login, but there is no way to send the same password reset email I can send through the G Suite Admin UI.
Is there a way to do this programmatically? If not through Apps Script, maybe there is a different way?
For reference, this is the functionality I am refering to (after the actual password reset):