Skip to content

Conversation

reivilibre
Copy link
Contributor

@reivilibre reivilibre commented Oct 14, 2025

Follows: #5106
Part of: #4492

This PR introduces some admin API endpoints for Personal Sessions.

  • add: Creates a personal session along with its first personal access token, returning both. This is currently the only way to get a personal access token.
  • get: Shows the information about a personal session
  • list: Shows many personal sessions
  • revoke: Revokes a personal session, so it can't be used anymore

Future:

  • regenerate: Revoke the active personal access token for a session and issue a new one to replace it.

Open question/thought I have: It seems like it would be good to bundle information about the active access token for each session, in the get and list endpoints.
For instance, I might want to filter on 'sessions with expired access tokens', or I might want to see the expiry time at a glance in the session list, or even sort by that time.
Wondering what your thoughts are on exposing that?

Should the relevant access token be embedded in attributes as a nested object?:

        {
          "data": {
            "type": "personal-session",
            "id": "01FSHN9AG0AJ6AC5HQ9X6H4RP4",
            "attributes": {
              "created_at": "2022-01-16T14:40:00Z",
              "revoked_at": null,
              "owner_user_id": "01FSHN9AG0MZAA6S4AF7CTV32E",
              "owner_client_id": null,
              "actor_user_id": "01FSHN9AG0MZAA6S4AF7CTV32E",
              "human_name": "Test session",
              "scope": "openid",
              "last_active_at": null,
              "last_active_ip": null,
              "access_token": {
                  "type": "personal-access-token",
                  "id": "XXXX",
                  "attributes": {
                    // ...
                    "expires_at": "..."
                  }
                }
            },
            "links": {
              "self": "/api/admin/v1/personal-sessions/01FSHN9AG0AJ6AC5HQ9X6H4RP4"
            }
          },
          "links": {
            "self": "/api/admin/v1/personal-sessions/01FSHN9AG0AJ6AC5HQ9X6H4RP4"
          }
        }

Copy link

cloudflare-workers-and-pages bot commented Oct 14, 2025

Deploying matrix-authentication-service-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3260f51
Status: ✅  Deploy successful!
Preview URL: https://c145c58a.matrix-authentication-service-docs.pages.dev
Branch Preview URL: https://rei-pat-admin.matrix-authentication-service-docs.pages.dev

View logs

@reivilibre reivilibre marked this pull request as ready for review October 14, 2025 11:51
@reivilibre reivilibre requested a review from sandhose October 14, 2025 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant