upbit / pixivpy

Pixiv API for Python
https://pypi.org/project/PixivPy3/#files
The Unlicense
1.79k stars 149 forks source link

[OAuth] Unable to Login to api using google account & password #97

Closed yanagiragi closed 4 years ago

yanagiragi commented 4 years ago

Currently found it is unable to login, however when using pixiv account it works.

Note:

  1. In pixiv webpage, I can't directly login when entering my google account/password, however I can login with the "Login With Google" Button

  2. In my memories, google auth should work as well (However I cannot test it for now, since it won't work anymore)

Here is the tests I use:

from pixivpy3 import *

api = AppPixivAPI()
api.auth("someMail@gmail.com", "somePassword")

Returned Error Message: (Account/Password were tested, able to login to Google to use OAuth to login to Pixiv)

HTTP 400: {"has_error":true,"errors":{"system":{"message":"103:pixiv ID、またはメールアドレス、パスワードが正しいかチェックしてください。","code":1508}}}
upbit commented 4 years ago

Dup of #92 Try upgrade to v3.5.1 to fix this.

You can try it first, if it still doesn't work, you can provide more details here

yanagiragi commented 4 years ago

@upbit Yes, currently I'm using version 3.5.1. Still not working.

upbit commented 4 years ago

What time zone are you in?

I am trying to locate this problem. The v3.5.0 error is caused by the inconsistent time zone of the signature.

yanagiragi commented 4 years ago

@upbit

I believe the timezone I use is UTC +08:00? Not sure if its you are asking.

I've notice v3.5.1 has fixed the time string format (ISO -> UTC), so the account I create from pixiv (Not from others OAuth) works fine for now.

upbit commented 4 years ago

嗯,是我理解錯了,聽你描述這個可能和OAuth賬號有關(我驗證的都是Pixiv註冊的賬號)

先留著這個問題,我找時間註冊個賬號試試

upbit commented 4 years ago

Is there an example of OAuth login to Pixiv? (Sniffer's package or code) I analyzed how it works.

目前有OAuth方式登录Pixiv的例子吗?(Sniffer的包或者代码)我分析下是怎么工作的

Mikubill commented 4 years ago

如果是OAuth登录的,可以使用Pixiv ID进行登录。(刚刚试了一下可以登录OAuth账户哒)

Pixiv ID在如下位置 d.png

upbit commented 4 years ago

@Mikubill 如果是这样,那OAuth理论上和正常登录一样,正常情况不会遇到1508的错误(如果没有特征验证方式的话) 这个绑定pixiv id后,api就work了吗?

Mikubill commented 4 years ago

我这边测试是OAuth登录后自动就有Pixiv ID了,然后就可以用ID登录了。~因为没有Google小号所以没测Google登录,不过Pixiv网页版的oauth都是用gigya来完成验证的,应该差不多吧(逃~

已经使用Google账号进行了测试,也是会自动生成Pixiv ID的

按 @yanagiragi 的意思,他好像直接拿Google账号密码去登录Pixiv了(?

Is there an example of OAuth login to Pixiv? (Sniffer's package or code) I analyzed how it works.

目前有OAuth方式登录Pixiv的例子吗?(Sniffer的包或者代码)我分析下是怎么工作的

Pixiv 应该是借助gigya的服务进行第三方登录的

Google
https://accounts.pixiv.net/gigya-auth?mode=signin&provider=googleplus&source=pc&view_type=page&lang=en&ref=wwwtop_accounts_index_google

Facebook
https://accounts.pixiv.net/gigya-auth?mode=signin&provider=facebook&source=pc&view_type=page&lang=en&ref=wwwtop_accounts_index_facebook

Sina
https://accounts.pixiv.net/gigya-auth?mode=signin&provider=sina&source=pc&view_type=page&lang=en&ref=wwwtop_accounts_index_sina
yanagiragi commented 4 years ago

我這邊的測試是使用

  1. Google 的帳號 與 密碼 登錄

  2. Pixiv 的 ID 與 Google 的密碼登錄

兩者皆不行登入。

@Mikubill 你是用哪種方式登入的呢? 我這邊試好像都不行

upbit commented 4 years ago

@yanagiragi OAuth的方式是https://accounts.pixiv.net/gigya-auth,采用OAuth协议去进行鉴权。而pixivpy使用的是pixiv自家账号来鉴权的,不支持直接用第三方账号登录(需要通过OAuth换key)

已知的:

  1. Google 的帳號 與 密碼 登錄: 这个肯定是错误的。OAuth方式不应该提供你的原始密码给第三方网站
  2. 使用pixiv和google的密码,这个也是错的。pixiv应该验证的是自己的账号,google的密码不应该提供给第三方服务
yanagiragi commented 4 years ago

@upbit 我同意您的說法。然而之前使用 akameco/pixiv-app-api (這個程式碼很大一部份是參考自 pixivpy) 時挺詭異的是當時還真的可以透過 Google 的帳號密碼來完成登錄,因此想說會不會這也是個因為這是改版而改掉的功能。

不過先不管上面提到的 pixiv-app-api (畢竟我現在也沒有辦法重現當時的狀況,何況他的程式碼未必 100% 參考 pixivpy 的邏輯),看起來如果要支援 OAuth, 需要的是另一層 OAuth 的 Lib 來協助登錄?

若是,這個 Issue 與其說是 report bug 不如說這比較像是 request feature? 這樣似乎可以考慮把這個 issue 給關掉了。

upbit commented 4 years ago

嗯,我看看 pixiv-app-api 的auth部分怎么实现的

yanagiragi commented 4 years ago

@upbit 補充一下,現在 pixiv-app-api 也不行了。

Mikubill commented 4 years ago

使用Google密码显然是不可以登录的。OAuth的情形下需要使用Pixiv ID + 在Pixiv设置的密码 登陆。

可以使用找回密码( https://myaccount.pixiv.net/password/reminder )的方法设置Pixiv账户密码。

另:其实通过Google OAuth登录Pixiv的时候应该是有设置密码的步骤的,使用当时设置的密码即可。当然如果忘了的话就只能重设密码啦(w

我這邊的測試是使用

  1. Google 的帳號 與 密碼 登錄
  2. Pixiv 的 ID 與 Google 的密碼登錄

兩者皆不行登入。

@Mikubill https://github.com/Mikubill 你是用哪種方式登入的呢? 我這邊試好像都不行

yanagiragi commented 4 years ago

@upbit @Mikubill

感謝指點。使用 @Mikubill 提供的方法後不管是使用 Pixiv ID 或是 使用 Google 的 OAuth 都可以正常運行了!(也許可以在 Readme 裡面註記這點? 有需要的話我可以幫忙)

如果沒有其它問題,我想可以把這個 Issue close 了?

upbit commented 4 years ago

嗯,能解决问题就好 👍 可以修改下issue的标题(让描述更明确些),其他人遇到类似问题可以搜索方便找到解决方案