mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 14:29:51 -04:00
Make API key combination of secret and service ID
In research we’ve seen people mix up the service ID and API key because they’re both 36 character UUIDs. We can’t get rid of the service ID because it’s used to look up the API key. Instead, we should change API key to be one long string, which contains both the service ID, API key and (optionally) the name of the key. For example: ``` casework_production-8b3aa916-ec82-434e-b0c5-d5d9b371d6a3-dcdc5083-2fee-4fba-8afd-51f3f4bcb7b0 ``` We still need to keep the old, separate, key and service ID for a while until people have updated their clients. But they’re now both on this page, rather than on two separate pages, which should make for less fussing anyway. This shouldn’t be rolled out until the new clients are available. - [ ] https://github.com/alphagov/notifications-python-client/pull/36 - [ ] https://github.com/alphagov/notifications-node-client/pull/10 - [ ] https://github.com/alphagov/notifications-ruby-client/pull/15 - [ ] https://github.com/alphagov/notifications-java-client/pull/38 - [ ] PHP????
This commit is contained in:
@@ -3,7 +3,7 @@ from flask_login import login_required
|
||||
from app.main import main
|
||||
from app.main.forms import CreateKeyForm, Whitelist
|
||||
from app import api_key_api_client, service_api_client, notification_api_client, current_service
|
||||
from app.utils import user_has_permissions
|
||||
from app.utils import user_has_permissions, email_safe
|
||||
from app.notify_client.api_key_api_client import KEY_TYPE_NORMAL, KEY_TYPE_TEST, KEY_TYPE_TEAM
|
||||
|
||||
|
||||
@@ -80,8 +80,12 @@ def create_api_key(service_id):
|
||||
key_name=form.key_name.data,
|
||||
key_type=form.key_type.data
|
||||
)
|
||||
return render_template('views/api/keys/show.html', secret=secret,
|
||||
key_name=form.key_name.data)
|
||||
return render_template(
|
||||
'views/api/keys/show.html',
|
||||
secret=secret,
|
||||
service_id=service_id,
|
||||
key_name=email_safe(form.key_name.data, whitespace='_')
|
||||
)
|
||||
return render_template(
|
||||
'views/api/keys/create.html',
|
||||
form=form
|
||||
|
||||
Reference in New Issue
Block a user