pixivpy: auth() failed
pixivpy3.utils.PixivError: [ERROR] auth() failed! check username and password.
HTTP 400: {"has_error":true,"errors":{"system":{"message":"access_denied","code":1508}}}
换账号login也是同样错误,同设备网页可以登录。
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 18 (4 by maintainers)
Links to this issue
Commits related to this issue
- Merge pull request #84 from DaRealFreak/fix/pixiv-auth fix oauth token request for pixiv, fixes #83 — committed to upbit/pixivpy by upbit 5 years ago
- Fix login error. Thanks for https://github.com/upbit/pixivpy/issues/83 — committed to bebound/pixivd by bebound 5 years ago
- Fix pixiv header https://github.com/upbit/pixivpy/issues/83 — committed to wxt2005/image-capture-bot-go by wxt2005 5 years ago
- fix: login error, missing client time/hash header thanks to https://github.com/upbit/pixivpy/issues/83#issuecomment-527163914 — committed to everpcpc/pixiv by everpcpc 4 years ago
updated my previous reply: X-Client-Time and X-Client-Hash header are now required and validated serverside. X-Client-Time is an RFC3339 converted timestamp X-Client-Hash consists of: md5([X-Client-Time]28c1fdd170a5204386cb1313c7077b34f83e4aaf4aa829ce78c231e05b0bae2c) so f.e. with X-Client-Time: 2019-09-02T20:51:57+02:00 the X-Client-Hash is: md5(2019-09-02T20:51:57+02:0028c1fdd170a5204386cb1313c7077b34f83e4aaf4aa829ce78c231e05b0bae2c) –> 5bb0b1ec0b6e1a86d7dc18dbea2c80bf
the Authentication works with these headers now again
Also not seeing any differences so far, just digging through the app what might have changed (Android pixiv 5.0.156):
client_id string client_secret string grant_type string username string password string device_token string get_secure_url boolean include_policy boolean
no changes in the request parameters
client_id -> MOBrBDS8blbauoSck0ZfDbtuzpyT client_secret -> lsACyCD94FhDUtGTXi3QzcFE2uU1hqtDaKeqrdwj grant_type -> password username -> [user] password -> [password] device_token -> [token (differs from device to device)] get_secure_url -> true include_policy -> true
client ID and client secret and other values are still the same too
OAuth2 URL -> https://oauth.secure.pixiv.net/auth/token
authentication URL still the same too
Headers: User-Agent -> PixivAndroidApp/%s (Android %s; %s) [VERSION.RELEASE, C5384a.m15939a(Build.MODEL)] Content-Type -> application/x-www-form-urlencoded;charset=UTF-8 Accept-Language -> Locale.getDefault().toString() -> [en_US,…] App-OS -> android App-Version -> 5.0.156 App-OS-Version -> 9.0.16 X-Client-Time -> new SimpleDateFormat(“yyyy-MM-dd’T’HH:mm:ssZZZZZ”, Locale.US).format(new Date()); X-Client-Hash -> md5([X-Client-Time]28c1fdd170a5204386cb1313c7077b34f83e4aaf4aa829ce78c231e05b0bae2c)
X-Client-Hash is now getting validated serverside, has to match the passed md5(X-Client-Time+28c1fdd170a5204386cb1313c7077b34f83e4aaf4aa829ce78c231e05b0bae2c)
possible referer:
also the same
ok works again with this:
the x-client-time and x-client-hash header have to properly match, else you’ll get the 1508 error code