z411 / trackma

Open multi-site list manager for Unix-like systems. (ex-wMAL)
https://z411.github.io/trackma
GNU General Public License v3.0
778 stars 82 forks source link

Issue adding AniList Account to Trackma-qt #445

Open purposelycryptic opened 5 years ago

purposelycryptic commented 5 years ago

This is a bit of an odd one - I updated Trackma to the latest code on GitHub today, and, as sometimes happens, trying to log in to AniList using the saved credentials from the previous version just caused it to crash (I'm on Windows, using Trackma-qt).

So I wiped my config and account files as usual, but when I tried to re-add my AniList account, the link to where you get your pin just showed the following error message:

{"error":{"status":404,"messages":["API route not found."]}}

So, after checking AniList's API guide, it became clear that the URL was definitely incorrect - their guide indicating that for a pin, it should be something like this (+ client info, etc):

https://anilist.co/api/v2/oauth/pin

but the URL Trackma took me to was this:

https://anilist.co/api/auth/authorize?grant_type=authorization_pin&client_id=z411-gdjc3&response_type=pin

...which almost looks like something from their v1 API before the switch.

Anyway, after some digging around in the Trackma code, I found what looked like the URL I needed in the utils.py file, namely:

https://anilist.co/api/v2/oauth/authorize?client_id=537&response_type=token

...and I went there, got the authorization code, and was able to log in, and Trackma launched. Happy end, hopefully.

But the fact that it sent me to the wrong URL for the authorization pin just seems odd - and, even after reverting to an older version, it still sent me to the same URL. I'm not sure where the issue originates, but I have updated Trackma many times since the AniList API switch, and I've never had anything like this occur, so I thought it worth bringing up, in case it ends up being a problem for anyone needing to redo their AniList login credentials.

FichteFoll commented 5 years ago

As a matter of fact, I had to refresh my token a couple days ago (using the qt ui) and I am pretty my browser opened https://anilist.co/login?apiVersion=v2&client_id=537&response_type=token& (according to my browsing history), which then redirected me to https://anilist.co/api/v2/oauth/pin#access_token=… (after 6 minutes of trying to solve that damn reCaptcha).

z411 commented 5 years ago

Same here, it's opening the browser properly to https://anilist.co/api/v2/oauth/authorize for me. Could it be that you have some old version of utils.py? Although that would be weird since Trackma wouldn't really work at all with such an old version of it...

Also I'm concerned about this that you mention:

as sometimes happens, trying to log in to AniList using the saved credentials from the previous version just caused it to crash

This shouldn't happen. What error do you get?

purposelycryptic commented 5 years ago

It definitely is weird - I can't imagine it being an old version of utils.py, since I zipped all the files from the previous installation as backup, then deleted them, before installing the new one, so there shouldn't really be any remnants floating around.

I used the usual git clone --recursive https://github.com/z411/trackma.git to get the fresh files before installing.

RE: crashing on attempted log-in with the accounts.dic from the previous install, this has happened to me quite a few times, to the point that I stopped using the option to automatically log in on launch because it just insta-crashes in that scenario.

I really should have copied the crash message, or at least taken a screenshot of it, but continuing to be seriously ill and feverish has somewhat dulled my better instincts these days. I'll try reinstalling again and capturing it this time.

I'm pretty sure it was the same exception thrown back when trying to log in back when AniList first switched to the v2 API, before Trackma was updated to work with it, if that helps - I'll post the exact message later after reinstalling though, as, while I definitely recognized the error message, I also don't remember what the precise reference was.

PS: the one thing I didn't encounter throughout the whole thing, humorously enough, was a reCaptcha, despite those things usually getting me at every possible occasion.

purposelycryptic commented 5 years ago

So, this is the error message I received:

Problem signature:
  Problem Event Name:   BEX64
  Application Name: pythonw.exe
  Application Version:  3.7.150.1013
  Application Timestamp:    5b331a31
  Fault Module Name:    ucrtbase.DLL
  Fault Module Version: 10.0.10586.9
  Fault Module Timestamp:   5642c48d
  Exception Offset: 00000000000698fe
  Exception Code:   c0000409
  Exception Data:   0000000000000007
  OS Version:   6.3.9600.2.0.0.256.103
  Locale ID:    1033
  Additional Information 1: f005
  Additional Information 2: f005e87acda0bab93592b04b3cadfbe5
  Additional Information 3: 705e
  Additional Information 4: 705e0f321d4f4a77a25537af63bab180

As for what it means, exactly... ???

EDIT:

And here are screenshots of what happens when I try to update my login token:

Capture1

Capture2