SMTP Authentication error even after using app passwords - python

Receiving this error smtplib.SMTPAuthenticationError: (534, b'5.7.9 Please log in with your web browser and then try again. Learn more at\n5.7.9 https://support.google.com/mail/?p=WebLoginRequired l16-20020a62be10000000b00580cc63dce8sm8588608pff.77 - gsmtp')
I have already logged in to the email with my web browser and it still does not work.
I am already using 2FA and App Passwords for authentication but am still receiving the error? Any ways to fix this?

Related

Is there a way for an application to send emails using SMTP with an account which is 2FA enabled while also not having access to the app password?

Our Flask application currently supports sending emails via SMTP (using Python's smtplib library), but the sender email available to us has 2FA enabled and app password disabled.
Given that we cannot use app passwords and 2FA is enabled, is it possible to send via SMTP or is there any other way of sending emails from this particular account using any service that works with 2FA?
When we try sending via SMTP using username/password, we get below error:
smtplib.SMTPAuthenticationError: (535, b'5.7.139 Authentication unsuccessful, the request did not meet the criteria to be authenticated successfully. Contact your administrator. [PN3PR01CA0027.INDPRD01.PROD.OUTLOOK.COM]')

Django Allauth Facebook Integration Login Failure

I've successfully integrated Google, Instagram and Vkontakte with django-allauth, but having problems with Facebook.
Here is what happens:
Click Login by Facebook Button on my website
Browser redirects to Facebook website for login, and facebook requests - password.
Facebook accepts the password
Browser redirects back to my website but gives the following error: "Social Network Login Failure, An error occurred while attempting to login via your social network account."
Login failed
I have SSL certificate set up.
Facebook Settings:
App Domains: example.com, www.example.com
Client OAuth Login: Yes
Web OAuth Login: Yes
Embedded Browser OAuth Login: Yes
Valid OAuth Redirect URIs: https://www.example.com/accounts/facebook/login/callback/
Deauthorize Callback URL: https://www.example.com/
Admin Settings:
Sites: example.com (SITE_ID = 3), www.example.com (SITE_ID = 2)
settings.py: SITE_ID = 2
Thanks in advance for your help!
I fixed this issue by adding the following to settings.py:
ACCOUNT_DEFAULT_HTTP_PROTOCOL='https'
I am in your same situation. It's been days and I cannot adjust this error.
This is my question on Stackoverflow: How to fix 'Social Network Login Failure' error of django-allauth deployed on Elastic Beanstalk
Edit: I saw your answer but it did not work for me, are you sure this was the only thing you changed to make it work?
Anyway, the value 'https' should be with quotes:
ACCOUNT_DEFAULT_HTTP_PROTOCOL = 'https'
Can you give more information about the changes you did in your code and configuration?

Hangups [github] failed login attempt

I'm trying to login to my google account using hangups.
Yet I'm getting the following error:
Login Failed (Unknown verification code input)
I know the password is correct since when I input an invalid password I get:
Login Failed (Authorization code cookie not found)
Please help! I tried generating an app password, doesn't work either.
Found the answer after using google in the appropriate way.
https://github.com/tdryer/hangups/issues/350#issuecomment-323553771

How to send an email through gmail using python?

I'm trying to send emails with my gmail account using python. I've already read many questions here and around the Internet, but none of them solved my problem.
The code that I'm using is the following (thanks to rosettacode), which is very similar to many other code snippets that can be found about this topic:
def sendemail(from_addr, to_addr_list, cc_addr_list,
subject, message,
login, password,
smtpserver='smtp.gmail.com:587'):
header = 'From: %s\n' % from_addr
header += 'To: %s\n' % ','.join(to_addr_list)
header += 'Cc: %s\n' % ','.join(cc_addr_list)
header += 'Subject: %s\n\n' % subject
message = header + message
server = smtplib.SMTP(smtpserver)
server.ehlo()
server.starttls()
server.ehlo()
server.login(login,password)
problems = server.sendmail(from_addr, to_addr_list, message)
server.quit()
return problems
My problem is during the login phase. It returns the following error message:
SMTPAuthenticationError: (534, '5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbsMX\n5.7.14 Z4_8qLgwTbhS2CwFvVApFvRfpIS1Vbbfun6gHcf0D6jgSQ-ixMn79mf3AivveTs9IhYsgq\n5.7.14 pmrp157H4Vmk6-ybAC9u2d2lNMYyy5pdmociqeSxBBwFGEPGJKHKdJpSocx86gzG-im6V-\n5.7.14 hsOeMKiJRAuGZjHUprEwj8oABwLzWQ8vEzovpXk79M-i8cnFseW-PNLxLlsK21WaLHLKmZ\n5.7.14 Ll3tEgQ> Please log in via your web browser and then try again.\n5.7.14 Learn more at\n5.7.14 https://support.google.com/mail/bin/answer.py?answer=78754 dc8sm25406976wib.7 - gsmtp')
I followed the suggested link and I found this answer, but I don't know if it could be the solution.
So, what's the problem? My account's settings? My code?
Google has recently tightened their security. Application that use username/password directly have been deactivated. All users are still able to reactivate these less secure application in their security settings as you have been reading in the link you gave in your question. This is the only solution at this point.
The alternative would be to use an other SMTP server for sending.
The error message you quote says
[..] Please log in via your web browser and then try again.
5.7.14 Learn more at
5.7.14 https://support.google.com/mail/bin/answer.py?answer=78754
This was already discussed in server send emails using gmail smtp gets alerts.
So I'd say that your code is fine and you're dealing with a Google-specific security mechanism.
You could enable Google's 2-step authentication and then generate an application-specific password for your script. I do the same (I also have similar code as you) and it works fine.

Google App Engine 1.7.6 Remote API error

Prior to the 1.7.6 dev server update, I was able to use /_ah/remote_api to upload test data to my dev server having to go through the authentication process by not entering a username and password (hitting return twice). Since the update, this now continuously asks for a username and password, regardless of what I put in - often says error incorrect username or password. I am currently targeting localhost:8080,
def auth_func():
return (raw_input('Username:'), getpass.getpass('Password:'))
remote_api_stub.ConfigureRemoteApi(None, '/_ah/remote_api', auth_func,
'localhost:8080')
though there are two new servers including the API server and the admin server. Has anyone else encountered this? if so, how did you fix it?
Thanks!
Jon
Apparently thanks to Tim - If you use the new dev_appserver then you need to sepecify a email like looking username and a single character as a password on the local development server in order for it to accept and move past the login stage.

Categories

Resources