Remove button for re-generating access token for API user #2620
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The "Re-generate" button revokes the access token and creates a new one for the same API user and application. However, in the meantime application(s) will continue to use the old (now revoked) access token and thus API requests will fail. A separate step is needed to sync the new valid access token to the relevant application container(s).
I suspect this is why the documentation used by #govuk-2ndline-tech recommends first creating a new access token and only revoking the old one once the new one has been synced to the relevant application container(s) and is confirmed to be working OK.
I've also looked at the count of
EventLog
records in production which seems to confirm that the "Re-generate" button has rarely been used:EventLog::ACCESS_TOKEN_GENERATED
: 88EventLog::ACCESS_TOKEN_REVOKED
: 74EventLog::ACCESS_TOKEN_REGENERATED
: 4I asked about this in Slack and @theseanything confirmed that the button would not be missed, because it's still possible to achieve the same effect via the UI albeit with more clicks.
Ideally we'd be able to trigger the syncing of access tokens from within the Signon codebase and fully automate the procedure that 2nd Line use. However, that's a bigger piece of work and out-of-scope for the moment.
I'm about to move the "Manage tokens for API user" page to use the GOV.UK Design System. Doing this first will make that easier.
I've left the
EventLog::ACCESS_TOKEN_REGENERATED
constant defined in order to support the historical records. However, I've changed an unrelated test to use a different constant and added a comment to make it clear that this constant is deprecated.