Skip to content

Add `last_used_at` field to personal_access_token API

What does this MR do and why?

Implements #328043 (closed)

Add the field last_used_at to the personal access tokens API

Screenshots or screen recordings

➜ curl http://localhost:3000/api/v4/personal_access_tokens -H "PRIVATE-TOKEN: ###" | jq

[
  {
    "id": 2,
    "name": "test_last_used",
    "revoked": false,
    "created_at": "2021-10-06T17:56:53.723Z",
    "scopes": [
      "read_api"
    ],
    "user_id": 1,
    "last_used_at": "2021-10-06T17:58:37.550Z",
    "active": true,
    "expires_at": null
  }
]

How to set up and validate locally

  1. Create and use a personal access token
  2. Invoke the personal access tokens endpoint

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Riccardo Padovani

Merge request reports