Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sign in attempt blocked by Google while using Gmail to send verification emails #233

Closed
ashar-7 opened this issue Nov 30, 2019 · 14 comments
Closed
Labels
Category: Documentation/Training Improvements or additions to documentation.

Comments

@ashar-7
Copy link

ashar-7 commented Nov 30, 2019

Describe the bug
Google doesn't allow sign from the app for sending verification emails due to "less secure sign-in technology".

Solution
Turning on less secure apps access solves this issue. This problem may occur while using other email providers too. So it would be great to have some documentation to help new users.

To Reproduce
Steps to reproduce the behavior:

  1. Use a Gmail account as the verification email sender (make sure less secure apps access is turned off)
  2. Register a new user (or resend a verification email) in the app
  3. You'll get an internal server error response in the app and a critical security alert in Gmail.

Screenshots
Screenshot_2

@sara-02
Copy link

sara-02 commented Dec 2, 2019

Just adding a note, this option to turn on the less secure apps is not available if you have enabled 2-step verification on Google. So one will have to disbale that first and then enbale the less secure app feature.

Quick update: Had to generate and add app password as a workaround.

@sara-02
Copy link

sara-02 commented Dec 2, 2019

Should get fixed by documenting a temporary email via this issue: #233

@isabelcosta
Copy link
Member

we should document this in a markdown file I think 🤔 and then also have this in the Wiki, for troubleshooting purposes

@sumit-badsara
Copy link
Contributor

sumit-badsara commented Feb 23, 2020

@isabelcosta @sara-02 We also have another another option which is much better and safer.

We can just go to Gmail and enable 2 step verification, and then go to App Passwords and generate a password for Mail app. Using that, even your email is secure and you don't need to configure anything else.

Reference : https://support.google.com/accounts/answer/185833?hl=en

I can create a PR regrading that in case you need it (We can add that in readme I guess 🤔 )

@sara-02
Copy link

sara-02 commented Feb 24, 2020

@BadduCoder I did the same. But something did not work, I finally had to switch off the 2 step Auth.
Do look into it and see if these steps work as expected.

@sumit-badsara
Copy link
Contributor

@sara-02 could you tell me what error are you getting and what steps have you followed ?

@mtreacy002
Copy link
Member

@BadduCoder I did the same. But something did not work, I finally had to switch off the 2 step Auth.
Do look into it and see if these steps work as expected.

@sara-02, I had this issue as well (#461) and switching 'OFF' 2 step verification and switch 'ON' Less secure app access fixed it for me. But I noticed you mentioned this already been done in your previous post.

@sumit-badsara
Copy link
Contributor

sumit-badsara commented Mar 3, 2020

Ohkay!
@mtreacy002 just try this once and tell me if this works:

  1. Go to https://myaccount.google.com/
  2. Go to Security
  3. Turn on 2-Step Verification
  4. Come back to Settings
  5. Go to App Passwords
  6. Generate a new password (app: Mail, device:Any)
  7. Copy that password and use it as password in .env file.

LESS SECURE APPS: OFF
2 FACTOR AUTH: ON

Just try this once and let me know the results.

@mtreacy002
Copy link
Member

Thanks, @BadduCoder. I gave it a try as you suggested above, and it works!! 👍.

@isabelcosta
Copy link
Member

@BadduCoder @mtreacy002 @sara-02 @ashar-7 I was thinking that there are some issues that could be documented in a doc as markdown file inside the docs folder. Something dedicated to troubleshooting some common problems developers face. I see this as one of them. I will create an issue for it.

@isabelcosta
Copy link
Member

OMG I just found another little step that made this go away at least for my Heroku deployment. Its here: https://www.twilio.com/blog/2018/03/send-email-programmatically-with-gmail-python-and-flask.html 🙌

These 2 steps

image

@isabelcosta
Copy link
Member

isabelcosta commented Mar 11, 2020

To fix the issue of the email internal server error, that i am getting from using a Gmail address to send email (caused by the security that Gmail provides), I will use another email.
I created a new email on https://www.mail.com/mail/

I am letting you know so you can also check this out for testing, I tested locally and so far, no issues. I will update the environment variables on Heroku app and hopefully this will be solved.
Here's the article I researched for Gmail alternatives: https://www.hongkiat.com/blog/gmail-alternatives/

Here's an example of how to set the env variables (if you are using https://www.mail.com/mail/):

MAIL_DEFAULT_SENDER=YOUR_MAIL_EMAIL
MAIL_SERVER='smtp.mail.com'
APP_MAIL_USERNAME='YOUR_MAIL_EMAIL'
APP_MAIL_PASSWORD='YOUR_MAIL_PASSWORD'

@mtreacy002
Copy link
Member

mtreacy002 commented Mar 24, 2020

Hi @isabelcosta, just curious, I can't reproduce the same error (internal server error) that caused by this Gmail blocking. I now need it to be blocked to test my #463 PR 🤣. I've posted a comment on that PR. And I also have pushed the changes requested by @ramitsawhney27 even though I couldn't test it coz that Gmail being so 'forgiving' to me... 😆.

@vj-codes
Copy link
Member

vj-codes commented Sep 7, 2020

@ashar-7 @isabelcosta closing since this issue cannot be reproduced by other new contributors

@vj-codes vj-codes closed this as completed Sep 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Documentation/Training Improvements or additions to documentation.
Projects
None yet
Development

No branches or pull requests

6 participants