For my purposes I have written a Go tool to obtain a User-API-Key. The utility can be found here:
% ./discourse-user-api-key -h
Program:
Name : discourse-user-api-key
Release : v1.0.0 - 2022/10/31
Purpose : obtain Discourse User-API-Key
Info : This program obtains a User-API-Key for a Discourse forum.
Usage:
./discourse-user-api-key -forum=string [-application=string] [-client=string] [-scopes=list] [-nonce=string] [-verbose]
Examples:
./discourse-user-api-key -forum=community.openstreetmap.org
./discourse-user-api-key -forum=meta.discourse.org -application=UltimateReaderWriter -scopes=read,write
Options:
-application string
name of application shown on forum site (default "GenericDiscourseReader")
-client string
client ID (default [generated unique UUID4])
-forum string
Discourse forum URL
-nonce string
random string generated once (default [generated URL-safe random string])
-scopes string
comma-separated list of access scopes allowed for the key (default "read")
-verbose
verbose output (maybe helpful in case of problems)
Workflow for getting an User-API-Key:
Step 1: copy forum URL into your browser
Step 2: authorize application access on forum site
Step 3: copy encrypted User-API-Key data from forum site in here
Step 4: save User-API-Key into your key vault
Maybe helpful for others.