Custom Mail With Gmail 2-Step Auth on ODK Central

1. What is the issue? Please be detailed.
I get a 500 error when trying to create a new user. On inspecting the logs on docker, I see:

Error: Invalid login: 535-5.7.8 Username and Password not accepted. For more information, go to
central-service-1  | 535 5.7.8 w6-20020aa7dcc6000000b00560a7b7b947sm225649edu.42 - gsmtp

Suggesting an auth issue. I am using a gmail account with 2-Step Auth, so I guess the username and password is not sufficient.

@yanokwa How do we handle this 2-Step Auth scenario for gmail?

2. What steps can we take to reproduce this issue?

  • .env file

Screenshot 2024-02-07 at 5.35.10 AM

  • Use a gmail account with 2-Step Auth enabled

3. What have you tried to fix the issue?
I tried setting the ports in env file; 465, 587, and the corresponding EMAIL_SECURE to true or false.
But I don't think this addresses the 2-Step Auth issue.

4. Upload any forms or screenshots you can share publicly below.
Screenshot 2024-02-07 at 5.45.51 AM

We don't recommend using Gmail for sending transactions emails. Use a dedicated email service such as Mailjet.

If you still want to use Gmail, then 2-step auth won't work. You'll have to sign in with an app passwords instead.