mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-09 14:53:00 +03:00
🚀 Feature: Bootstrap Admin API Key #195
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @nicholascioli on GitHub.
Feature description
Externally managing Pocket ID (either through terraform, ansible, and the like) can be difficult without manually bootstrapping an admin user, a passkey for the admin user, and then an API key for accessing the management API. This can be overkill, especially in cases where Pocket ID will be entirely managed externally. It would be nice if there existed a configuration option for a static and always valid API token that an external system could use to manage all aspects of Pocket ID.
Pitch
External management of core infrastructure is typically handled through infrastructure-as-code resources using tooling like ansible or kubernetes operators. These external managers usually replace the need for a dedicated admin user and allow for tighter control over configuration and access control. Needing to bootstrap an admin user complicates this process and introduces more avenues for error. Other software that implements something similar to this are listed below:
BOOTSTRAP_ADMIN_EMAILandBOOTSTRAP_ADMIN_PASSWORD_ARGON2ID)I saw that there exists a way to generate one time passcodes for accounts, which would definitely help in the bootstrap process. The only issue is that the user needs to exist first, so it doesn't work with bootstrapping an admin API token since the admin user isn't created until later.
@kmendell commented on GitHub:
@stonith404 I'll defer to you on this one if you feel its worth implementing.
@stonith404 commented on GitHub:
Thank you for your suggestion. While I understand your use case, I don't think it's worth implementing because it's quite easy to do with a simple script. Here is an example in JS:
You basically have to call the
/api/one-time-access-token/setupendpoint, which only works if there is only one user in the database and this user hasn't added a passkey yet. This endpoint returns a temporary access token which you then can use to create an actual API key.I hope this fits your needs.
@nicholascioli commented on GitHub:
For context, this came up since I'm trying to write a (simple) kubernetes operator for Pocket ID and got sad thinking about how to correctly bootstrap it without manual intervention.
@elonen commented on GitHub:
The
/api/one-time-access-token/setupendpoint didn't actually work in v1.8.Instead, I had to create a temporary user and then create the API key with something like:
Also, it seems deleting the temporary user will invalidate the API key, too.