Skip to content

Chat throwing 401 when user not created mobile-native#4467

Ben requested to merge fix/chat-401-mob4467 into master

Ticket(s) / Related Merge Requests

mobile-native#4467 (closed)

Summary of Changes

Catch 401 and rethrow as 403 for consumption by clients of our API to avoid logout behaviour on mobile.

Testing Considerations

This is going to need testing against staging as we have no Matrix in our sandbox env. Locally I tested by dropping this in the Matrix Client (mocking the Sentry error captured)

throw new ClientException(
    'Invalid macaroon passed',
    new Request('GET', 'url'), 
    new Response(
        401,
        [],
        '{"errcode":"M_UNKNOWN_TOKEN","error":"Invalid macaroon passed.","soft_logout":false}'
    )
);

If you just want to test the current sandbox behaviour, go to a channel, sub to it and hit message.

Deployment Considerations

Standard deployment.

Regression Scope

Chat integrations.

Platform Affected (web, mobile, etc)

Web / Mob

Developer Testing Completed

As much as was possible, manual, and unit tests.

Screenshots / Screen Recording

image

Does this impact

  • Localization
  • Dark/light mode
  • Guest mode

Definition of Done Checklist

  • The Acceptance Criteria has been met
  • Code is tested: Testing includes unit/spec, E2E/automated and manual testing
  • Merge requests description has been filled out
Edited by Ben

Merge request reports