Skip to content

feat: add name and token_last_characters to ApiToken #58918

Closed
@mdtro

Description

@mdtro

As part of the initial work for RFC #32 we need to add a name and token_last_characters column to the ApiToken model.

This will help users more easily identify their API tokens and their intended use (see issue #9600 and https://github.com/getsentry/customer-feedback/issues/22).

I had a PR that accomplishes this on the backend (see #58876), but it needs to be broken up into three different ones in order to avoid any weird states and running multiple backfills.

### Tasks
- [x] Add nullable `name` and `token_last_characters` fields to the `ApiToken` model
- [x] Update the `.save()` method on `ApiToken` to add the `token_last_characters` on new `ApiToken`s
- [x] Run a backfill migration that updates existing tokens and sets the `token_last_characters`
- [x] Update backend serializer to handle optional `name` field for the `ApiToken`
- [x] Update frontend to display and allow name to be set for `ApiToken`s

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions