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

pixiv seems not allowing username/password login now #158

Open
roytam1 opened this issue Feb 9, 2021 · 37 comments
Open

pixiv seems not allowing username/password login now #158

roytam1 opened this issue Feb 9, 2021 · 37 comments

Comments

@roytam1
Copy link

roytam1 commented Feb 9, 2021

server returning JSON:

{"has_error":true,"errors":{"system":{"message":"The grant type is unauthorized for this client_id","code":1508}},"error":"invalid_grant"}
@roytam1
Copy link
Author

roytam1 commented Feb 9, 2021

background information:

In pixiv android Version 5.0.234 in 2021-02-08, there is a line:

  • From the beginning of February 2021, you'll have to update your app to the latest version if you're running ver.5.0.219 or earlier.

and for testing, I tried to install 5.0.220.1 apk and tried to login, and it pops out custom browser window and jumps to pixiv standard login form.

@roytam1
Copy link
Author

roytam1 commented Feb 9, 2021

a cross reference is found: #140 (comment)

@kilosonc
Copy link

kilosonc commented Feb 9, 2021

I encountered the same problem

HTTP 400: {"has_error":true,"errors":{"system":{"message":"Invalid grant_type parameter or parameter missing","code":1508}},"error":"invalid_grant"}

I want to use set_auth, but I don't know which is access token, there're to many pairs in cookie

@roytam1
Copy link
Author

roytam1 commented Feb 9, 2021

I want to use set_auth, but I don't know which is access token, there're to many pairs in cookie

they're not exist in cookies or IndexedDB or Local Storage.

@evazion
Copy link

evazion commented Feb 10, 2021

In my project I had to revert back to using the Ajax API. The problem is that the grant_type=password authentication method is no longer supported. The Pixiv app now logs in through https://accounts.pixiv.net/login, but this page is protected by Google reCAPTCHA, which seems impossible to circumvent.

I think that as long as you have a refresh token, you can keep using it, but getting one is tricky since you have to login with the mobile app and sniff traffic to get it.

https://github.com/danbooru/danbooru/blob/39cc3ed5cf913499093d2f641d70d7682a14fa42/app/logical/pixiv_ajax_client.rb

@emesh0620
Copy link

If password authentication is disabled, is there no choice but to scrape with BeautifulSoup from now on? Unbelievable

@Mouwoo
Copy link

Mouwoo commented Feb 10, 2021

Screenshot_20210210_155236
经测试该账号和密码可以pixiv官网正常登录

@emesh0620
Copy link

Last year, you said that you are trying not to register with a leaked password, but you are also considering methods such as multi-factor authentication, so it is time to think about some fundamental measures. It may be. (Link to Japanese)

https://inside.pixiv.blog/2020/01/22/180000

@mrwan2546
Copy link

Pixiv was changed grant_type password to authorization_code. But it's so hard to login because pixiv using login with OAuth 2.0
image

@ZipFile
Copy link
Contributor

ZipFile commented Feb 11, 2021

Pixiv now follows RFC7636. We won't be able to use (old) password login again, but there is a way to automate token retrieval without traffic sniffing. I've implemented a simple script to retrieve access/refresh tokens. Right now it requires single manual step inspecting dev console, but in general, entire flow could be fully automated using browser extensions: you can add request handler and extract code param from the url.

@reimu1234
Copy link

Update the semi-automatic script, get the code through chromedriver

更新了半自动脚本,通过chromedriver获取code

https://gist.github.com/upbit/6edda27cb1644e94183291109b8a5fde

请问手机端能拿到吗 pc 的试了拿到code后就过不去了 开了全局

@upbit
Copy link
Owner

upbit commented Feb 24, 2021

Update the semi-automatic script, get the code through chromedriver
更新了半自动脚本,通过chromedriver获取code
https://gist.github.com/upbit/6edda27cb1644e94183291109b8a5fde

请问手机端能拿到吗 pc 的试了拿到code后就过不去了 开了全局

如果能输出code,可以参考requests的代理配置,对95行的post请求增加代理

@reimu1234
Copy link

Update the semi-automatic script, get the code through chromedriver
更新了半自动脚本,通过chromedriver获取code
https://gist.github.com/upbit/6edda27cb1644e94183291109b8a5fde

请问手机端能拿到吗 pc 的试了拿到code后就过不去了 开了全局

如果能输出code,可以参考requests的代理配置,对95行的post请求增加代理

都试了才来打扰😂

@upbit
Copy link
Owner

upbit commented Feb 24, 2021

试试换个代理?这个和ZipFile的原始脚本一样,都用requests直接请求的。或者试下 Mapaler 的GUI工具

ps: 手机端没试过,如果你用term跑python应该可以;纯浏览器会打开app,无法拦截code

@Mapaler
Copy link

Mapaler commented Feb 24, 2021

@yzwik 手机端用浏览器获取code会打开P站APP,除非你把P站APP卸载掉,自己写一个注册pixiv协议的APP来获取code。
获取的登陆code只有几十秒的生存时间,需要尽快使用,不然就过期了。你电脑获取的话,需要马上转移到手机上使用。
或者你可以电脑上登陆了后,把刷新code拿去直接添加刷新code,刷新code的生存时间非常长。

@txperl
Copy link
Contributor

txperl commented Feb 24, 2021

Update the semi-automatic script, get the code through chromedriver
更新了半自动脚本,通过chromedriver获取code
https://gist.github.com/upbit/6edda27cb1644e94183291109b8a5fde

请问手机端能拿到吗 pc 的试了拿到code后就过不去了 开了全局

如果能输出code,可以参考requests的代理配置,对95行的post请求增加代理

都试了才来打扰😂

可以通过 pixivpy bypass SNI 的方式,先获取 API 的真实 IP,然后直接请求,就不需要代理了。

参考脚本:
https://github.com/txperl/PixivBiu/blob/24119157facdef4eb31ab6492eb32b583d01c7bf/app/core/biu/login_token.py

参考实现:
https://github.com/txperl/PixivBiu/blob/24119157facdef4eb31ab6492eb32b583d01c7bf/app/core/biu/main.py#L164

@reimu1234
Copy link

试试换个代理?这个和ZipFile的原始脚本一样,都用requests直接请求的。或者试下 Mapaler 的GUI工具

ps: 手机端没试过,如果你用term跑python应该可以;纯浏览器会打开app,无法拦截code

确实是代理的问题 换了个节点解决😂 感谢大佬帮助

SlashNephy added a commit to SlashNephy/stella that referenced this issue Feb 27, 2021
SlashNephy added a commit to SlashNephy/stella that referenced this issue Feb 27, 2021
* Upgrade Ktor to 1.5.2

* Refactoring

* Fix COPY

* Downgrade KMongo due to NoClassDefFoundError

* Fix serialization error

* Revert _id renaming

* Replace type-unsafe mongo java binding

* Replace write with File#writeBytes

* Update paths

* Fix POST data handling

* Set stella log definition

* Fix id reference

* Fix null type

* Revert to use GlobalScope

* Add HttpClient logging

* Implement REFRESH_TOKEN based Pixiv Auth

upbit/pixivpy#158

* Refresh last token

* Refactoring

* Fix Nijie login
@TianyiShi2001
Copy link

TianyiShi2001 commented Mar 8, 2021

如果是有reCAPTCHA的话那就不可能全自动了吧

不过cookie不是太快过期的话倒也不太影响使用

@eggplants
Copy link
Contributor

https://gist.github.com/upbit/6edda27cb1644e94183291109b8a5fde

I have written a library/CLI based on this script to get tokens headlessly in selenium.
Check: https://github.com/eggplants/get-pixivpy-token

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

No branches or pull requests