Skip to content

Calling /versions no longer works when the access token requires a refresh (via MAS). #5816

@pixlwave

Description

@pixlwave

We started noticing an issue recently on Element X (both platforms) which goes something along these lines:

  • Launch the app when both the access token and the cached ServerInfo (which contains /versions data) have expired.
  • The SDK attempts to make a /versions request.
  • As of Upgrade Ruma #5789, Ruma now includes the access token on /versions meaning that the following error is returned
    • Api(Server(ClientApi(Error { status_code: 401, body: Standard { kind: UnknownToken { soft_logout: false }, message: "Token is not active" } })))
  • The SDK sees that error and attempts to refresh the access token.
  • Refreshing the access token via MAS requires knowledge of the authentication server so a get_authorization_server_metadata request is sent.
  • A get_authorization_server_metadata request requires knowledge of the supported /versions in order to build the correct path.
  • Bad things happen™️

In practice we've seen this manifest in 2 different ways:

  • The session is restored and navigation throughout the app works, but the SDK only ever sends /versions requests no matter what you attempts to do.
  • Whilst setting up the session, SyncServiceBuilder::finish throws the following error which (on EXI at least) we handle with a fatal error
    • Generic(msg: "the server returned an error: [401 / M_UNKNOWN_TOKEN] Token is not active", details: Optional("RoomList(SlidingSync(Http(Api(Server(ClientApi(Error { status_code: 401, body: Standard { kind: UnknownToken { soft_logout: false }, message: \"Token is not active\" } }))))))"))

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions