2

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:

  1. Create the user
  2. Go through the "reset password" flow
  3. 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):

Reset password screen

Laura
  • 3,233
  • 3
  • 28
  • 45
  • Unfortunately that's not possible, see [here](https://stackoverflow.com/questions/60029628/admin-sdk-generate-link-to-access-reset-password-page). – ziganotschka Aug 25 '20 at 12:24
  • So far all that I found is that you can reset the password with user.update and then email that password using gmail api – Braulio Ruiz Jan 27 '21 at 22:59
  • Isn't sending an email with the password in plaintext a little bit risky ? – Paulloed Mar 09 '21 at 03:04
  • 1
    @Paulloed exactly - that's why it would be nice to be able to trigger the password reset email programmatically (which includes a passwort reset link, but no password) – Laura Apr 27 '21 at 11:39

0 Answers0