- Open on Drupal.org →Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7last update
about 1 year ago Waiting for branch to pass - 🇫🇮Finland oakulm
I had a same request so here is a patch. Added a new button next to "Generate new key" called "Save key" and changed markup field to input field and added a handler for "Save key" action.
- Open on Drupal.org →Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7last update
about 1 year ago Waiting for branch to pass - last update
about 1 year ago Composer require failure - 🇺🇸United States Jon Pugh Newburgh, NY
I don't recommend this approach in the core module.
However I too need the ability to insert an existing key.
My use case is for testing and development of a number of sites at once. I want to hard code a key into the development settings so that I don't have to generate a new one and set it in the client everytime I install or sync the site in.
To add a key, just set the api_key field on users. Custom code or an add on module for managing keys could be created.
See UserKeyAuthForm::submitForm():
// Generate a new key. User::load($form['#uid']) ->set('api_key', $this->keyAuth->generateKey()) ->save();
- Open on Drupal.org →Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7last update
about 1 year ago Waiting for branch to pass - @jon-pugh opened merge request.
- Open on Drupal.org →Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7last update
about 1 year ago Waiting for branch to pass - 🇺🇸United States Jon Pugh Newburgh, NY
I created a new branch and merge request to add a drush command: 'key:set'
Patch attached.
MR here: https://git.drupalcode.org/project/key_auth/-/merge_requests/13
- Open on Drupal.org →Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7last update
about 1 year ago Waiting for branch to pass - 🇺🇸United States Jon Pugh Newburgh, NY
Here's what it looks like:
www-data@7840126ff815:~$ drush key:set admin In KeyAuthCommands.php line 64: User already has API key. Use --force option to overwrite it. www-data@7840126ff815:~$ drush key:set admin --force ! [NOTE] User's existing API key was removed. [success] API key for user admin was set to 9a99e567bbd5983beb318274baf96273. www-data@7840126ff815:~$ drush key:set admin abc123 --force ! [NOTE] User's existing API key was removed. [success] API key for user admin was set to abc123.
- Open on Drupal.org →Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7last update
about 1 year ago Waiting for branch to pass - 🇺🇸United States Jon Pugh Newburgh, NY
Catch missing user and improve messaging.
- Open on Drupal.org →Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7last update
about 1 year ago Waiting for branch to pass - 🇫🇮Finland oakulm
I don't recommend this approach in the core module.
Hi! Could you explain this a bit more? Because I can't really see much the difference if you use drush or admin UI for this.
- Status changed to Needs work
11 months ago 10:19pm 12 December 2023 Still needs a permission added for whether a user role can edit the key manually.
- Status changed to Needs review
11 months ago 10:23pm 12 December 2023 Never mind. There's a separate issue for that.
✨ A separate permission to access Key authentication in user profile Needs review
- 🇮🇳India rajeshreeputra Pune
@jonpugh, @solideogloria would you mind joining the project to maintain, as I get very less time to look into it.
I could possibly co-maintain, but I don't have any real experience maintaining a module. I've only done patches and merge requests. Though the Media: YouTube module is listed on my profile, I didn't do anything for that module and removed myself from being maintainer.
I also don't have a dev environment set up for contributing, so when I want to contribute patches or code to a module, I don't have any phpcs integration in my IDE; I just open the folder in a workspace and modify the files. I have yet to figure that out.