Gallery-dl: Pixiv - Invalid or missing login credentials

Created on 10 Feb 2021  Â·  10Comments  Â·  Source: mikf/gallery-dl

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?

site-change

Most helpful comment

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)

All 10 comments

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

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

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

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!

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

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?

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 )

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

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)

New version with the changes from https://github.com/mikf/gallery-dl/commit/8974f0361c9cd9b53a7b7b21c96bd21b997dd596 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 8faf03ed (2018) and it still works.

@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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

biznizz picture biznizz  Â·  4Comments

blackoutworm picture blackoutworm  Â·  5Comments

ucok66 picture ucok66  Â·  3Comments

ucok66 picture ucok66  Â·  6Comments

TestPolygon picture TestPolygon  Â·  3Comments