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 - Invalid or missing login credentials #1304

Closed
ImVantexHD opened this issue Feb 9, 2021 · 10 comments
Closed

Pixiv - Invalid or missing login credentials #1304

ImVantexHD opened this issue Feb 9, 2021 · 10 comments

Comments

@ImVantexHD
Copy link

It worked two days ago but now it shows this error:

C:\Users\Marian\Downloads>gallery-dl -v https://www.pixiv.net/en/artworks/80631308
[gallery-dl][debug] Version 1.16.4
[gallery-dl][debug] Python 3.6.0 - Windows-8.1-6.3.9600-SP0
[gallery-dl][debug] requests 2.25.1 - urllib3 1.26.2
[gallery-dl][debug] Starting DownloadJob for 'https://www.pixiv.net/en/artworks/80631308'
[pixiv][debug] Using PixivWorkExtractor for 'https://www.pixiv.net/en/artworks/80631308'
[pixiv][info] Logging in as vantex-hd
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): oauth.secure.pixiv.net:443
[urllib3.connectionpool][debug] https://oauth.secure.pixiv.net:443 "POST /auth/token HTTP/1.1" 400 138
[pixiv][debug] {"has_error":true,"errors":{"system":{"message":"Invalid grant_type parameter or parameter missing","code":1508}},"error":"invalid_grant"}
[pixiv][error] AuthenticationError: Invalid or missing login credentials

my login info is correct in the config file, i even changed the password but it still doesn't work, i can login in the browser just fine, does anyone have this problem?

@mikf
Copy link
Owner

mikf commented Feb 9, 2021

Pixiv disabled authenticating with username and password for their mobile API:

It still works for anyone with a cached refresh token, though.

mikf added a commit that referenced this issue Feb 12, 2021
- remove login with username & password
- require a refresh token
- add 'oauth:pixiv' functionality

See also:
- upbit/pixivpy#158
- https://gist.github.com/ZipFile/c9ebedb224406f4f11845ab700124362
@mikf
Copy link
Owner

mikf commented Feb 12, 2021

Instead of being able to conveniently log in with username & password, it is now required to get a refresh_token. You either already have one cached from logging in when that was still possible, or you can get a new one with gallery-dl oauth:pixiv. It is not quite as simple as other oauth:… flows and requires the use of browser dev tools to copy&paste a code query parameter:

$ gallery-dl oauth:pixiv

1) Open your browser's Developer Tools (F12) and switch to the Network tab
2) Login
3) Select the last network monitor entry ('callback?state=...')
4) Copy its 'code' query parameter, paste it below, and press Enter

code: ...

screenshot

For more details see

@octrhiumlofera
Copy link

octrhiumlofera commented Feb 12, 2021

Hi, @mikf. I've just lost my access token (due to OS reinstallation) and I assumed there is no other way to retrieve it back. This patch will be more than enough for me. Any ETA when the next release will be published?

Update: Since the issue has been closed already, I decided to build from source and finally got it working. Thanks!

@ImVantexHD
Copy link
Author

1) Open your browser's Developer Tools (F12) and switch to the Network tab
2) Login
4) Select the last network monitor entry ('callback?state=...')
4) Copy its 'code' query parameter, paste it below, and press Enter

Thanks, everything is working fine now

@biznizz
Copy link

biznizz commented Feb 14, 2021

Do we know how long the refresh-token will last? Is it a one and done, or will we have to do this every month or few?

@conkerts
Copy link

1) Open your browser's Developer Tools (F12) and switch to the Network tab
2) Login
4) Select the last network monitor entry ('callback?state=...')
4) Copy its 'code' query parameter, paste it below, and press Enter

Thanks, everything is working fine now

Huh ... why closed ?
So there is no way around it to make it as comfortable as it was ?

And I can't even run gallery-dl oauth:pixiv
I'm getting
[gallery-dl][error] No suitable extractor found for 'oauth:pixiv'

(Do I need some latest git dev version or something ? I'm at 1.16.4 rn )

@ImVantexHD
Copy link
Author

1) Open your browser's Developer Tools (F12) and switch to the Network tab
2) Login
4) Select the last network monitor entry ('callback?state=...')
4) Copy its 'code' query parameter, paste it below, and press Enter

Thanks, everything is working fine now

Huh ... why closed ?
So there is no way around it to make it as comfortable as it was ?

And I can't even run gallery-dl oauth:pixiv
I'm getting
[gallery-dl][error] No suitable extractor found for 'oauth:pixiv'

(Do I need some latest git dev version or something ? I'm at 1.16.4 rn )

Get the code from the dev archive and unpack it
Navigate into the respective directory and run the setup.py file
python setup.py install

@Hrxn
Copy link
Contributor

Hrxn commented Feb 14, 2021

You can (and should) install dev versions directly from the repo with pip as well:
https://github.com/mikf/gallery-dl#pip
(The second example)

@mikf mikf pinned this issue Feb 14, 2021
@mikf
Copy link
Owner

mikf commented Feb 14, 2021

New version with the changes from 8974f03 is out:
https://github.com/mikf/gallery-dl/releases/tag/v1.16.5

It is also possible to put your refresh-token value directly in your config file, by the way. You don't have to rely on your cache file for it. Instead of having two entries for username and password, you can now add one for refresh-token.

@biznizz Refresh tokens for Pixiv don't expire. I've been using mine since 8faf03e (2018) and it still works.

@biznizz
Copy link

biznizz commented Feb 14, 2021

@biznizz Refresh tokens for Pixiv don't expire. I've been using mine since 8faf03e (2018) and it still works.

Nice, so you'll only have to do this extra step once so long as you have the cache file intact (or putting it directly into the config as you also mentioned)?

Well that's good. It took a few tries for me to get it to work, I got a few errors saying that the code had expired before I was able to cache it.

@mikf mikf unpinned this issue Mar 6, 2021
ClosedPort22 added a commit to ClosedPort22/gallery-dl that referenced this issue Jan 5, 2023
The Pixiv extractor requires a 'refresh-token' since 974f0361c9cd9b53a7b7b21c96bd21b997dd596 (mikf#1304).
ClosedPort22 added a commit to ClosedPort22/gallery-dl that referenced this issue Jan 5, 2023
The Pixiv extractor requires a 'refresh-token' since 8974f03 (mikf#1304).
ClosedPort22 added a commit to ClosedPort22/gallery-dl that referenced this issue Jan 5, 2023
The Pixiv extractor requires a 'refresh-token' since 8974f03 (mikf#1304).
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

6 participants