Authentication with Ankiweb for Add-on deploy from GitHub

Hello, everyone

Sorry, if this question is already answered somewhere. I’ve created Cambridge 1875288089 add-on and adapted previous authentication mechanism with GitHub actions. Recently, I’ve discovered that this mechanism changed to something called sveltekit. I’ve worked payload and understand, that logging and password are being sent as a octet bitstream. I’ve recreated such requests but Ankiweb refuse to authenticate me with 422 http response.

If it’s possible, please advice me how I should implement it properly?

1 Like

AnkiWeb’s terms and conditions do not allow add-ons to access it. You will need to use AnkiConnect instead.

It’s not Addon which perform authorization, it’a a CI/CD pipeline, GitHub Action in this case. Basically, it could be any implementation.

It’s not about accessing user data (decks, cards, notes, etc.), so I assume that AnkiConnect is not suitable in this case.

If you are trying to upload your add-on automatically, AnkiWeb does not currently have a public API for this, so you’ll need to use the website for now.

I understand that, so, I’m using website for this. I send the same POST request with payload as any web browser does.

Ideally, ones need an API for these kind of automation. However, it’s fairly easy to use curl for imitation.

Alright, the first part - authentication - has been done. It turned out that payload data has this structure
'\n\u0010$ANKI_LOGIN\u0012\u000$ANKI_PASSWORD'
Now, the next hurdle to overcome - sending form data, but now, with Svelte, it’s no more usual form-data, it’s octet stream with ambiguous delimiters between parts. Also, it’s surprising that chosen for updating zip file is being sent uncompressed as a stream of ascii chars (like tar all files into 1 file and send it).


sample payload extracted with Chrome DevTools

You’re accessing a private API, which is against the T&Cs. I’m afraid you will need to do this manually until such time as an official API is provided.