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

Login failed #145

Open
gyrex opened this issue Jul 25, 2018 · 13 comments
Open

Login failed #145

gyrex opened this issue Jul 25, 2018 · 13 comments

Comments

@gyrex
Copy link

gyrex commented Jul 25, 2018

I'm using 2FA and when I try and login using pyportify and an app password generated from https://security.google.com/settings/security/apppasswords

I get a "Login failed". I've also tried using the command line with the same error.

Does anyone have any ideas? Is there some way to generate a log with pyportify?

Edit: I check the google audit logs (https://admin.google.com/AdminHome?fral=1#Reports:subtab=login-audit) and there doesn't appear to be an attempt to login.

@srikirancse
Copy link

Facing the same issue.

@srikirancse
Copy link

srikirancse commented Aug 2, 2018

Wait... So this happens only in my office network and I am able to login to google account in my home network. So @gyrex try to login by turning off your VPN if you are on one.

@jcax2
Copy link

jcax2 commented Aug 7, 2018

Same Here.

@dornan2
Copy link

dornan2 commented Aug 16, 2018

Same with me even on home network without VPN

@rckclmbr
Copy link
Owner

This works fine for me. I wonder, are you trying to use a G Suite account? I'm using a gmail account and app passwords works fine.

@dornan2
Copy link

dornan2 commented Aug 18, 2018

Basic Gmail account for me. Once I added 2fa and used app passwords it worked. Was getting Login Failed using the basic Gmail account and home connection beforehand.

@anantkamath
Copy link

Solution that worked for me:

  • On your android device, find your Android Device ID (I used this app to find it)

  • On line 25 in $PYTHON_PATH/site_packages/pyportify/google.py replace

    android_id = _get_android_id()

    with

    android_id = "YOUR_ANDROID_DEVICE_ID".upper()

@akumar-cs
Copy link

akumar-cs commented Sep 5, 2018

@anantkamath ^ worked for me. Thanks !!

@dhamaniasad
Copy link

I also faced an SSL issue with Spotify, and add verify_ssl=False here helped (app.py):

with ClientSession(connector=aiohttp.TCPConnector(verify_ssl=False)) as session:

@caccialdo
Copy link

In my case, I had to:

  • temporarily turn ON "Less secure Apps" on this page
  • "Allow access to your Google Account" on that page.

After that I was able to log in to my Google account.

Hope it helps.

@cryocaustik
Copy link

cryocaustik commented Sep 18, 2019

instead of disabling 2FA and/or exposing your Google account to less secure apps, use a Google App Password, which you can generate specifically for this app and then discard/disable it when you're done.

@realchrisolin
Copy link

realchrisolin commented Sep 23, 2019

running into this exact issue with a G-Suite account. Using an app password and/or allowing access to my account doesn't work, trying to log in still throws the login failed error. I've had 2FA turned on since 2013, and it's looking like the only way to use pyportify with a 2FA enabled G-Suite account is to temporarily disable it.

edit: still can't log in to my G-Suite account using the account password after disabling 2FA. I've done a little debugging and troubleshooting. Came across https://developers.google.com/gdata/docs/auth/clientlogin and found this note:

Note: By default, the client libraries set an account-type parameter to HOSTED_OR_GOOGLE. That means ClientLogin will first try to authenticate the user's credentials as a G Suite account. If that fails, it will try to authenticate as a Google Account. This becomes tricky if [email protected] is both a Google Account and a G Suite account. In that special case, set the account type to GOOGLE if the user wishes to use the Google Accounts version of [email protected].

I changed all off the accountType references to 'GOOGLE' to see if it made a difference (it didn't). I started setting some breakpoints and eventually narrowed the issue to gpsoauth.perform_oauth. Ultimately, Google is returning error 403 DeviceManagementRequiredOrSyncDisabled. I haven't looked up that error yet, but I'll post an update if I'm able to get past it.

@realchrisolin
Copy link

Alright, looks like I figured it out. I've got one of those free legacy G-Suite plans, which is part of the problem here. The default mobile management setting is set to "basic", which seems to be too basic and throws the DeviceManagementRequiredOrSyncDisabled error when trying to login.

image

The "advanced" setting looks like it might fix this, but since it's not available for for the legacy plan, shutting off mobile management entirely allows me to log in with a 2FA app password. The URL for the mobile management page is https://admin.google.com/AdminHome?hl=en#MobileSettings:section=setup&flyout=setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests