rckclmbr / pyportify

App to transfer your spotify playlists to Google Play Music
Apache License 2.0
779 stars 57 forks source link

Login failed #145

Open gyrex opened 6 years ago

gyrex commented 6 years ago

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 commented 6 years ago

Facing the same issue.

srikirancse commented 6 years ago

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 commented 6 years ago

Same Here.

dornan2 commented 6 years ago

Same with me even on home network without VPN

rckclmbr commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

Solution that worked for me:

akumar-cs commented 6 years ago

@anantkamath ^ worked for me. Thanks !!

dhamaniasad commented 5 years ago

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 commented 5 years ago

In my case, I had to:

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

Hope it helps.

cryocaustik commented 4 years ago

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 commented 4 years ago

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 user@example.com 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 user@example.com.

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 commented 4 years ago

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.