From 82210ddf8746f445b1fd76ab6567e71face82d99 Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Sun, 24 Sep 2023 12:39:52 -0400 Subject: [PATCH] Make it slightly clearer how to enable authentication. The README previously sort of covered this, but in particular it was not obvious to me that the request parameter that corresponded to enabling `apiKey` is called `key`, and not `apiKey`, which ultimately made me have to look at the source code to figure this out (even though the word `key` is mentioned elsewhere on the page, it still wasn't very easy to make the connection). This section puts all the required information in one spot. --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 1f63011..6e38088 100644 --- a/README.md +++ b/README.md @@ -156,6 +156,13 @@ const result = await invoke('deckNames', 6); console.log(`got list of decks: ${result}`); ``` +### Authentication + +Anki-Connect supports requiring authentication in order to make API requests. +This support is *disabled* by default, but can be enabled by setting the `apiKey` field of Anki-Config's settings (Tools->Add-ons->AnkiConnect->Config) to a desired string. +If you have done so, you should see the [`requestPermission`](#requestpermission) API request return `true` for `requireApiKey`. +You then must include an additional parameter called `key` in any further API request bodies, whose value must match the configured API key. + ### Hey, could you add a new action to support $FEATURE? The primary goal for Anki-Connect was to support real-time flash card creation from the