Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • pleroma pleroma
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 647
    • Issues 647
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 90
    • Merge requests 90
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • PleromaPleroma
  • pleromapleroma
  • Merge requests
  • !3380

Return token's primary key with POST /oauth/token

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Alex Gleason requested to merge oauth-token-id into develop Mar 24, 2021
  • Overview 3
  • Commits 4
  • Pipelines 3
  • Changes 4

I'm developing multi-account support in Soapbox FE, and storing user tokens in the browser with localStorage.

I would like users to be able to review their active sessions and revoke them. In particular, I want a user to know which session is their current session.

We are able to see a list of users sessions (aka oauth tokens) from GET /api/oauth_tokens.json to render a display like this:

Screenshot_from_2021-03-24_12-13-54

This endpoint (/api/oauth_tokens.json) returns a list of token IDs:

Screenshot_from_2021-03-24_12-12-47

In order to consolidate this output with user tokens in the browser, I need the ID of the token in response to POST /oauth/token. This MR adds it, and improves the mastoapi differences document around authentication.

Before (POST /oauth/token):

{
  "access_token": "ZA-Yj3aBD8U8Cm7lKUp-lm9O9BmDgdhHzDeqsY8tlL0",
  "token_type": "Bearer",
  "scope": "read write follow push",
  "created_at": 1573979017
}

After:

{
  "id": 3673,
  "access_token": "ZA-Yj3aBD8U8Cm7lKUp-lm9O9BmDgdhHzDeqsY8tlL0",
  "token_type": "Bearer",
  "scope": "read write follow push",
  "created_at": 1573979017
}
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: oauth-token-id