Skip to content

/refresh endpoint does not accept second refresh tokens #19287

@krille-chan

Description

@krille-chan

Description

I hope that I don't understand the API wrong but as far as I can see Synapse behaves not correct, when using the /refresh endpoint to refresh the refresh&access tokens.
I'm not yet talking about using Matrix Native OIDC. But using MAS or not results in the same behavior as far as I can see. When claiming that the app supports refresh tokens by setting "refresh_token": true when using POST /client/v3/login the first request to /refresh works as expected, but the second always gets rejected and I don't see the reason for it.

Steps to reproduce

  • Login with "refresh_token": true
  • Refresh the tokens by using the POST /refresh endpoint
  • Use the new access token for something like GET /sync so it gets activated
  • Refresh the tokens with the new refresh token
    -> It fails

Homeserver

janian.de, matrix.org, any version

Synapse Version

1.143.0

Installation Method

Docker (matrixdotorg/synapse)

Database

PostgreSQL

Workers

Single process

Platform

Ubuntu 24.04 VM

Configuration

No response

Relevant log output

Login Response after logging in:

{
"access_token": "mct_blneWnwgmfBpVyNR6O6eHr7Xlf7LTJ_1kBgq3",
"device_id": "*******",
"user_id": "@*****:janian.de",
"refresh_token": "mcr_Q9TlHgaSKbQSVEf9aXnk2kH9rHGGfg_SVKDa3",
"expires_in_ms": 300000
}

First Refresh Response with:

mcr_Q9TlHgaSKbQSVEf9aXnk2kH9rHGGfg_SVKDa3

{
"access_token": "mct_aR2RFFqb3WAyTQFSeLbvqI06VNnIHa_ikdEF2",
"refresh_token": "mcr_xEe0TNy1kFgG066lbWdL2iKB4jIsfc_QsWmU4",
"expires_in_ms": 300000
}

Second failed Refresh Response with:

mcr_xEe0TNy1kFgG066lbWdL2iKB4jIsfc_QsWmU4

{"errcode":"M_UNKNOWN_TOKEN","error":"Invalid refresh token"}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions