# Adding command line tools support for user api keys

**URL:** <https://meta.discourse.org/t/adding-command-line-tools-support-for-user-api-keys/103803>\
**Category:** Development\
**Created:** [December 6, 2018, 11:21pm UTC](https://meta.discourse.org/t/adding-command-line-tools-support-for-user-api-keys/103803 "2018-12-06T23:21:13Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![vsoch](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vsoch/32/124967_2.png) [@vsoch](https://meta.discourse.org/u/vsoch)\
**Post date:** [December 6, 2018, 11:21pm UTC](https://meta.discourse.org/t/adding-command-line-tools-support-for-user-api-keys/103803/1 "2018-12-06T23:21:13Z")

</div>

I can give you my use case to help a bit with next steps! I’ve added a discourse endpoint to the “helpme” client → [HelpMe | HelpMe - a command line tool for helping you out.](https://vsoch.github.io/helpme/faq) and [Journal of Open Source Software: HelpMe Command Line Helper Utility](https://joss.theoj.org/papers/18dcee0f359b9fbcc76bbdd8ac88fda4) so that users can ask for help from the command line with any of the following:

```bash
helpme discourse
helpme discourse neurostars.org
helpme discourse neurostars.org braincategory

```

And specifically, they can post a topic, record an asciinema (terminal recording), capture the environment, and of course include text! Actually you can see a recording and full details in this pull request → [Add Discourse Helper by vsoch · Pull Request #33 · vsoch/helpme · GitHub](https://github.com/vsoch/helpme/pull/33). So - what this comes down to is the user needing an api token to create a topic. They would export it once to their environment:

```bash
export HELPME_DISCOURSE_TOKEN=xxxxx

```

and then it would save to their personal configuration in $HOME. There is also an “admin” configuration that could provide a token to a user, but 1. it’s more likely the user has installed it on his/her own, and 2. The user could discover the token via looking into the running code. So ideally, I want:

1. Given I am a user of a discourse board, and user tokens are enabled, I have a web page I can go to and it will generate a token for me.
2. I can then plug it into the client to make a post!

The issue with using some “All Users” or admin token is that we can’t ship that with the software or even risk that it gets in the hands of anyone other than an admin. So the ideal is either already living with discourse, or on a separate server that has it too. Given the second, I’m not sure how we would connect the interface to a particular discourse board (and somewhat delegate the giving out of tokens) so I think the first is most logical. I’ve never made a plugin before, nor have I coded in ruby, so I would need much pointers on these things.

---

_[View the full topic](https://meta.discourse.org/t/adding-command-line-tools-support-for-user-api-keys/103803)._
