API key creation

AI-generated summary

The discussion revolves around API key creation in Discourse. manojm321 inquires about allowing users to create their own API keys, but not-ethan responds that there is no setting for this. However, ClawdiaWolf corrects this, stating that users with trust level 1 and higher can generate API keys through a somewhat complicated process. Two methods are available: hijacking the DiscourseHub app protocol, as outlined in the User API keys specification, or using a Ruby script posted by @Falco, as seen in Generate user API keys for testing.

IIUC, today only ADMINs can create API key, I don’t see a reason why I shouldn’t allow user to do it for themselves for their corresponding trust_level. is there a setting I can toggle?

Unfotently there is no setting to allow users to make API keys.

Actually, there is, and they’re enabled for TL1 users and higher, but the process is a little complicated.

Assuming an admin hasn’t changed any settings, then User API keys are possible to generate mostly automatically if you can hijack the protocol used by the DiscourseHub app to generate a key.

There is a slightly more complicated manner for it as well.

@Falco posted a sample Ruby script here that shows an alternate way of generating them.

On my instance that has a lot of devs who use the API heavily we did modify the settings to allow the callback URL to be http://localhost:56399/discourse so the original method would work for us running local servers but that’s not necessary if you use the method in @Falco’s post.