Skip to content

Save token_id and time_expires from access token grant to credentials file #1127

@david-crespo

Description

@david-crespo

Fields added in oxidecomputer/omicron#8280, addressing oxidecomputer/omicron#8279.

Now that access tokens have generated ids that are used as the identifier in access token view/delete operations (introduced in #8227), it becomes hard to relate them with credentials.toml. For example, in the list token API response, the user sees only the tokens that haven't expired

$ oxide --profile recovery api /v1/me/access-tokens
{
  "items": [
    {
      "id": "6feec54c-6e3a-4c1a-9f82-8acd7a0ef249",
      "time_created": "2025-06-05T04:28:42.946403Z",
      "time_expires": null
    }
  ],
  "next_page": "eyJ2IjoidjEiLCJwYWdlX3N0YXJ0Ijp7InNvcnRfYnkiOiJpZF9hc2NlbmRpbmciLCJsYXN0X3NlZW4iOiI2ZmVlYzU0Yy02ZTNhLTRjMWEtOWY4Mi04YWNkN2EwZWYyNDkifX0="
}

But credentials.toml currently doesn't include the token id (and expired tokens aren't automatically removed from the file). So, it's posssible that user sees more tokens here:

[profile.recovery]
host = "https://recovery.sys.berlin.eng.oxide.computer"
token = "oxide-token-935212d5e41079cf0bcfc9ec84c0f8f7c09aac6b"
user = "8a705181-8afe-4604-86d6-06f4b5fac6e9"

[profile.recovery2]
host = "https://recovery.sys.berlin.eng.oxide.computer"
token = "oxide-token-c0187754418f8112ddf00b4767f546288f215ed8"
user = "8a705181-8afe-4604-86d6-06f4b5fac6e9"

When user wants to remove an expired token from the toml file or even to confirm which one should be used for certain requests, it's easy to make a mistake.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions