matrix-org / matrix-org/matrix-ios-sdk

[MxHttpClient] When server returns a code error 401, only errorcode and error are managed

Open
#323 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Objective-C
Stars
484
Forks
225
PR merge metrics
No merged PRs in 30d

Description

To secure login operation (and protect paswword), some protocols exist based on 3 steps operations.
For example RFC 2617 (used in SIP or HTTP)
A new matrix login based on such a protocol would be like this:

**Step1**: matrix client posts a first request "_matrix/client/v0/NewLogin" with missing parameters
=> server anwers with 401 status code bur provides a json response containing parameters used for step2

**Step2**: correct input parameters are computed by matrix client based on first response returned by server

**Step3**: matrix client posts another request with all needed parameters on same url "_matrix/client/v0_wn/NewLogin"
=> If succes, server answers with status code 200 otherwise with 40* as status code.

Currently it is not possible to implement such a protocol because when server answers with status code 401, MXHTTPClient only returns an NSerror, so that only errorcode and error fields are parsed to be tranformed into an NSError. Other fields in response are ignored.

Is it possible to update MXHTTPClient to manage this case that is to say it will return a json containing all fields returned by server even if error code different than 200?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating MXHTTPClient and reading how non-200 responses are converted into NSError objects. Trace the handling of a 401 response and identify the existing response tests, if present; done means response fields beyond errorcode and error remain available to support the documented three-step login flow.

Written by the indexing model from the issue text.

Assessment

Tech stack
objective-c
Domain
api, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.