TSedlar / anitrack

A web extension that tracks what you're watching/reading with MyAnimeList or Kitsu
MIT License
30 stars 7 forks source link

Kitsu updating bug #17

Closed TSedlar closed 6 years ago

TSedlar commented 6 years ago

The Kitsu PATCH protocol does not work for library modifications.

I have contacted the developer of the Kitsu API to get more information on this.

There is a workaround to modify your library and grab the Bearer AUTH that Kitsu will generate, but it only works for 24 hours, thus not being stable in this.

The public Bearer auth in the Kitsu API works for everything else, just not modification.

Auth: 54d7307928f63414defd96399fc31ba847961ceaecef3a5fd93144e960c0e151

Response:

403 Forbidden: You don’t have permission to update the library entry.
chrislegault commented 6 years ago

Maybe you have the authorization confused? You need to auth against their oauth endpoint with users username and password to get the oauth token you would send in subsequent calls to update their library.

TSedlar commented 6 years ago

@astraldragon

I don't believe they have that implemented currently. The official node API has this listed for authentication:

and the documentation lists the following:

so the key in the documentation should work.

chrislegault commented 6 years ago

Right but to modify someone's library you have to be authenticated as that person. If that wasn't the case you'd be able to modify everyone's libraries :)

You have to use a combination the client id, secret, username and password to get an oauth token back from the api. The auth endpoint lives at: https://kitsu.io/api/oauth/token.

TSedlar commented 6 years ago

@astraldragon

I've also tried using the Basic authentication

Is there another way to go about it? Because that works fine through MyAnimeList

Edit: I've just seen your edit and I'll approach that soon, thank you!

chrislegault commented 6 years ago

MyAnimeList is an entirely different method of authentication. Kitsu uses oauth so as far as I know basic auth will not work. You could use something like https://github.com/lelylan/simple-oauth2 or https://github.com/mulesoft/js-client-oauth2 to get yourself up and running quick

TSedlar commented 6 years ago

Thanks @astraldragon!

Fixed in 901adf7