pyportify icon indicating copy to clipboard operation
pyportify copied to clipboard

Login failed

Open gyrex opened this issue 7 years ago • 13 comments

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.

gyrex avatar Jul 25 '18 11:07 gyrex

Facing the same issue.

srikirancse avatar Aug 01 '18 15:08 srikirancse

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.

srikirancse avatar Aug 02 '18 01:08 srikirancse

Same Here.

jcax2 avatar Aug 07 '18 18:08 jcax2

Same with me even on home network without VPN

dornan2 avatar Aug 16 '18 15:08 dornan2

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.

rckclmbr avatar Aug 18 '18 07:08 rckclmbr

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.

dornan2 avatar Aug 18 '18 08:08 dornan2

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()

anantkamath avatar Aug 28 '18 19:08 anantkamath

@anantkamath ^ worked for me. Thanks !!

akumar-cs avatar Sep 05 '18 05:09 akumar-cs

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:

dhamaniasad avatar Jan 22 '19 16:01 dhamaniasad

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.

caccialdo avatar Mar 21 '19 23:03 caccialdo

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.

cryocaustik avatar Sep 18 '19 22:09 cryocaustik

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 avatar Sep 23 '19 06:09 realchrisolin

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.

realchrisolin avatar Sep 23 '19 07:09 realchrisolin